From: Michael Eager <eager@eagercon.com>
To: gcc-patches@gcc.gnu.org
Cc: Jan-Benedict Glaw <jbglaw@lug-owl.de>
Subject: [PATCH] Fix uninitialized variable warnings
Date: Thu, 20 Oct 2022 09:50:44 -0700 [thread overview]
Message-ID: <562bb602-4a49-46b5-acd2-5755372aa755@eagercon.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 419 bytes --]
The attached patch corrects a couple uninitialized variable warnings.
The variables are initialized to NULL and tests 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?
--
Michael Eager
[-- Attachment #2: 0001-Fix-uninitialized-variable-warnings.patch --]
[-- Type: text/x-patch, Size: 3343 bytes --]
From a0fd2e9baa51e85f61cebd6e78bef8b5c55199b5 Mon Sep 17 00:00:00 2001
From: Michael Eager <eager@eagercon.com>
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 <eager@eagercon.com>
+
+ * 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 <aldyh@redhat.com>
* 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
reply other threads:[~2022-10-20 16:50 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=562bb602-4a49-46b5-acd2-5755372aa755@eagercon.com \
--to=eager@eagercon.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jbglaw@lug-owl.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).