From patchwork Thu Oct 20 17:35:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Eager X-Patchwork-Id: 6312 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp236853wrr; Thu, 20 Oct 2022 10:36:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4kuKplF8lg6XKz8p4siYB0VIgUcehVNPibcS1wADu0S3S7WY2r8mY1p7TeKVpkEDiZUGih X-Received: by 2002:a05:6402:4444:b0:458:f355:ce04 with SMTP id o4-20020a056402444400b00458f355ce04mr13413171edb.422.1666287379836; Thu, 20 Oct 2022 10:36:19 -0700 (PDT) Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id gb38-20020a170907962600b0078261fd56efsi18756504ejc.571.2022.10.20.10.36.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Oct 2022 10:36:19 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=fail header.i=@eagerm.com header.s=dreamhost header.b=ExmgOkVY; arc=fail (signature failed); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id F1A27384B12C for ; Thu, 20 Oct 2022 17:36:04 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from dog.elm.relay.mailchannels.net (dog.elm.relay.mailchannels.net [23.83.212.48]) by sourceware.org (Postfix) with ESMTPS id 6AE41384D17E for ; Thu, 20 Oct 2022 17:35:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6AE41384D17E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=eagerm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=eagerm.com X-Sender-Id: dreamhost|x-authsender|eager@eagerm.com Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id E5DA7340BC8; Thu, 20 Oct 2022 17:35:38 +0000 (UTC) Received: from pdx1-sub0-mail-a309 (unknown [127.0.0.6]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 6EE6E340B8F; Thu, 20 Oct 2022 17:35:38 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1666287338; a=rsa-sha256; cv=none; b=yzurPAP9VA1TrikqeehTExHI85LOTbmfVuMBQMXQerd2/3GvDfh6Jo3hMluYK2lrVoIiyB NGa6z7qwg00jcEKP23+QbgJCvzKvhW6WC3X29+taKP2pvhZjSb65UWHzY6Jt/ovcYjdxG1 LfT1KUeeIqy+igQAU0mZ3x21Iug4/gpP3KncULJnmxnQDtEq8ZMTVMTr95pcmu0NAOlwoQ ReEW+ikQJuNeaKYYFswHIaANBFPNtVGAMf69PVaJvJpBBkQ0H9WwM0RCRyE3rPOHpTwkHo cHuZQy8YASDwFxx6IXKcQq2NGQuVJ44Ab2CEZERcYqaESqMKnf8dK/HhVEoDtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1666287338; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: dkim-signature; bh=8gvvmZ/hyNjIDAN387r9L6/NUDxwCRV6Z02vr2KJ7j0=; b=D718em8WJMXyPOdR5KxgRAXH45vRk/xYXk5iiK3JR+QOuKNgQUazfyNdHu2yzbHYhsD/ik UV9DtxpL5UbpVKAxcLdnvdXZoaIo6iAus9bHyNs5etWPh2xOnLoAWHFh4u3QPVslbUiKa9 0J7Q24OmTI1UU8XWD9k360Lu02WfTc6pm15jnJnsbV0U0ut694TsVbl9tZ8THU8993Qj3A zM5lqDAWAU0A/4+ZVxn3udad8Lo6+sMP/gHdfhlOH6hZtrU+lyKas/IadKL1nOq66e/A58 FDDbY7BkqBA9PIsU7864OUonz9UEJOa9Nt0uB7IKstW0exRiq7bcUgrQWkG14g== ARC-Authentication-Results: i=1; rspamd-7fb88f4dd5-nmhx4; auth=pass smtp.auth=dreamhost smtp.mailfrom=eager@eagerm.com X-Sender-Id: dreamhost|x-authsender|eager@eagerm.com X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|eager@eagerm.com X-MailChannels-Auth-Id: dreamhost X-Coil-Whispering: 694abad37d4bab22_1666287338725_3205772667 X-MC-Loop-Signature: 1666287338725:320025590 X-MC-Ingress-Time: 1666287338724 Received: from pdx1-sub0-mail-a309 (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.122.72.98 (trex/6.7.1); Thu, 20 Oct 2022 17:35:38 +0000 Received: from [192.168.20.12] (c-73-241-148-180.hsd1.ca.comcast.net [73.241.148.180]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: eager@eagerm.com) by pdx1-sub0-mail-a309 (Postfix) with ESMTPSA id 4MtZWG0W8Yz3R; Thu, 20 Oct 2022 10:35:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eagerm.com; s=dreamhost; t=1666287338; bh=8gvvmZ/hyNjIDAN387r9L6/NUDxwCRV6Z02vr2KJ7j0=; h=Content-Type:Date:From:Subject:To:Cc; b=ExmgOkVYUKdhVZ7o8LlugbmvxgehZFfM00+d5HbNxZKVCBoz07RpkNIn3fWYZJSZD g3rr2UNfb9GdM4ia2G0+rPuAfvNIxQeEAX/3czBEPAYi/Uo3Jd4VYJ1PwNRpX9VWrD w9KLvl3Vx1pRdJlO/PMMp64YZsrf0AcQYxqRCNbt/KmtuTq4gKhmuqdJOM3MXF5lX9 RVcc53ikb6Nes7xAnlNZX+CF5QOUKQLNd4puDHngn+Yaa26P14cC64ivnKyQ4AEK/k SaiKV9ai8XZSZcCaNrk9hS0/iv09I8jIsVeHp76zxvoE9QnKG2fI8lLSeYXRnLw3jr xWk+YdrYa637w== Message-ID: Date: Thu, 20 Oct 2022 10:35:37 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 From: Michael Eager Subject: [PATCH] Microblaze: Fix uninitialized variable warnings To: gcc-patches@gcc.gnu.org Content-Language: en-US X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747228955449912164?= X-GMAIL-MSGID: =?utf-8?q?1747228955449912164?= The attached patch corrects a couple uninitialized variable warnings. The variables are initialized to NULL and tested for this, calling gcc_unreachable(). Replace other calls to abort() for with gcc_unreachable(). Thanks to Jan-Benedict Glaw for bringing this to my attention. ** I'm receiving a "service not enabled" error when I push. ** Can someone apply this patch while I resolve this issue? From a0fd2e9baa51e85f61cebd6e78bef8b5c55199b5 Mon Sep 17 00:00:00 2001 From: Michael Eager Date: Thu, 20 Oct 2022 09:33:13 -0700 Subject: [PATCH] Fix uninitialized variable warnings gcc/ChangeLog: * gcc/config/microblaze/microblaze.cc (microblaze_legitimize_address): Initialize 'reg' to NULL, check for NULL. (microblaze_address_insns): Replace abort() with gcc_unreachable(). (print_operand_address): Same. (microblaze_expand_move): Initialize 'p1' to NULL, check for NULL. (get_branch_target): Replace abort() with gcc_unreachable(). --- gcc/ChangeLog | 9 +++++++++ gcc/config/microblaze/microblaze.cc | 19 ++++++++++++++----- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7a50293c780..8271fafe033 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2022-10-20 Michael Eager + + * gcc/config/microblaze/microblaze.cc + (microblaze_legitimize_address): Initialize 'reg' to NULL, check for NULL. + (microblaze_address_insns): Replace abort() with gcc_unreachable(). + (print_operand_address): Same. + (microblaze_expand_move): Initialize 'p1' to NULL, check for NULL. + (get_branch_target): Replace abort() with gcc_unreachable(). + 2022-10-19 Aldy Hernandez * range-op-float.cc (build_le): Document result. diff --git a/gcc/config/microblaze/microblaze.cc b/gcc/config/microblaze/microblaze.cc index 8fcca1829f6..9290a1f3958 100644 --- a/gcc/config/microblaze/microblaze.cc +++ b/gcc/config/microblaze/microblaze.cc @@ -1103,7 +1103,7 @@ microblaze_legitimize_address (rtx x, rtx oldx ATTRIBUTE_UNUSED, if (GET_CODE (xinsn) == SYMBOL_REF) { - rtx reg; + rtx reg = NULL; if (microblaze_tls_symbol_p(xinsn)) { reg = microblaze_legitimize_tls_address (xinsn, NULL_RTX); @@ -1133,6 +1133,11 @@ microblaze_legitimize_address (rtx x, rtx oldx ATTRIBUTE_UNUSED, reg = pic_ref; } } + else + { + /* This should never happen. */ + gcc_unreachable (); + } return reg; } @@ -1474,7 +1479,7 @@ microblaze_address_insns (rtx x, machine_mode mode) case TLS_DTPREL: return 1; default : - abort(); + gcc_unreachable (); } default: break; @@ -2624,7 +2629,7 @@ print_operand_address (FILE * file, rtx addr) fputs ("@TLSDTPREL", file); break; default : - abort(); + gcc_unreachable (); break; } } @@ -3413,7 +3418,7 @@ microblaze_expand_move (machine_mode mode, rtx operands[]) } if (GET_CODE (op1) == PLUS && GET_CODE (XEXP (op1,1)) == CONST) { - rtx p0, p1, result, temp; + rtx p0, p1 = NULL, result, temp; p0 = XEXP (XEXP (op1,1), 0); @@ -3423,6 +3428,10 @@ microblaze_expand_move (machine_mode mode, rtx operands[]) p0 = XEXP (p0, 0); } + /* This should never happen. */ + if (p1 == NULL) + gcc_unreachable (); + if (GET_CODE (p0) == UNSPEC && GET_CODE (p1) == CONST_INT && flag_pic && TARGET_PIC_DATA_TEXT_REL) { @@ -3799,7 +3808,7 @@ get_branch_target (rtx branch) if (GET_CODE (call) == SET) call = SET_SRC (call); if (GET_CODE (call) != CALL) - abort (); + gcc_unreachable (); return XEXP (XEXP (call, 0), 0); } -- 2.31.1