From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1656) id 5EF0F3858D1E; Sat, 22 Oct 2022 23:34:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5EF0F3858D1E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1666481659; bh=WIzPDsUGRJl62PSfJrSWjBAQN4UU4zRycHLb9YAAvy8=; h=From:To:Subject:Date:From; b=k2DBLeX0C7QOPyHm6VGfRTCCRfztHN4i/BuwSxpA3LQMikaQ2gCmbGxZdiDE/0UcO Z3npTA8x82lwU4tOenyd8R3gNUtDiT19/uG3S/QN5/ZLKL6GM9wl4VggQPgUmtQ9/x xD6hhL2OAR9BEv6yB152451J9gmoiAYBmPONdwNQ= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Michael Eager To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-3444] Fix uninitialized variable warnings. X-Act-Checkin: gcc X-Git-Author: Michael Eager X-Git-Refname: refs/heads/master X-Git-Oldrev: 423df44a090846b9c59650efb11745f07914f1d5 X-Git-Newrev: fef16c45198b6405e07325fd2f843a4f04ae86aa Message-Id: <20221022233419.5EF0F3858D1E@sourceware.org> Date: Sat, 22 Oct 2022 23:34:19 +0000 (GMT) List-Id: https://gcc.gnu.org/g:fef16c45198b6405e07325fd2f843a4f04ae86aa commit r13-3444-gfef16c45198b6405e07325fd2f843a4f04ae86aa Author: Michael Eager Date: Sat Oct 22 16:23:16 2022 -0700 Fix uninitialized variable warnings. Check for use of previously uninitialized variables; call gcc_unreachable(). Replace abort() with gcc_unreachable(). 2022-10-22 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(). Diff: --- gcc/config/microblaze/microblaze.cc | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) 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); }