Hi! On 2019-05-06T11:36:22+0200, Richard Biener <[email protected]> wrote: > On Sat, 4 May 2019, Richard Sandiford wrote: >> Richard Biener <[email protected]> writes: >> > On Fri, 3 May 2019, Richard Biener wrote: >> >> I am testing the following patch [...]
... which apparently also got backported to gcc-9-branch eventually...
>> >> Note this will handle even more CFG shapes now and seems to
>> >> expose some uninit warnings in dwarf2out.c (at least).
..., and when building gcc-9-branch with
'--enable-checking=yes,extra,rtl' (apparently I'm the only one doing
that, huh?), runs into the following (at least I suppose that's what's
meant with "expose some uninit warnings in dwarf2out.c"?):
In file included from [...]/source-gcc/gcc/coretypes.h:433,
from [...]/source-gcc/gcc/dwarf2out.c:60:
[...]/source-gcc/gcc/machmode.h: In function 'dw_loc_descr_node*
mem_loc_descriptor(rtx, machine_mode, machine_mode, var_init_status)':
[...]/source-gcc/gcc/machmode.h:520:42: error: 'int_mode' may be used
uninitialized in this function [-Werror=maybe-uninitialized]
520 | ? mode_size_inline (mode) : mode_size[mode]);
| ^~~~
[...]/source-gcc/gcc/dwarf2out.c:15464:19: note: 'int_mode' was declared
here
15464 | scalar_int_mode int_mode, inner_mode, op1_mode;
| ^~~~~~~~
cc1plus: all warnings being treated as errors
make[3]: *** [dwarf2out.o] Error 1
>> > I can't seem to find an initializer that would "trap" on use
>> > so I'm going to do
>> >
>> > Index: gcc/dwarf2out.c
>> > ===================================================================
>> > --- gcc/dwarf2out.c (revision 270849)
>> > +++ gcc/dwarf2out.c (working copy)
>> > @@ -15461,7 +15461,7 @@ mem_loc_descriptor (rtx rtl, machine_mod
>> > if (mode != GET_MODE (rtl) && GET_MODE (rtl) != VOIDmode)
>> > return NULL;
>> >
>> > - scalar_int_mode int_mode, inner_mode, op1_mode;
>> > + scalar_int_mode int_mode = SImode, inner_mode, op1_mode;
>> > switch (GET_CODE (rtl))
>> > {
>> > case POST_INC:
>> >
>> > unless somebody comes up with something clever over the weekend...
>>
>> Nothing clever, but something rare like BImode is probably safer than
>> SImode, in case doing this masks real "uninitialised" uses in future.
>
> Ick, and I forgot to install this hunk when I committed it this morning.
>
> Thus fixed as obvious now, with BImode.
..., so I backported that fix (or is it rather "fix"?) to gcc-9-branch in
r277608 "Avoid '-Wmaybe-uninitialized' diagnostic in 'gcc/dwarf2out.c'",
see attached.
Grüße
Thomas
From 3d82e409c5ef4d39908bd9798d096862af3eb4ca Mon Sep 17 00:00:00 2001
From: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Wed, 30 Oct 2019 10:50:58 +0000
Subject: [PATCH] Avoid '-Wmaybe-uninitialized' diagnostic in 'gcc/dwarf2out.c'
With '--enable-checking=yes,extra,rtl':
In file included from [...]/source-gcc/gcc/coretypes.h:433,
from [...]/source-gcc/gcc/dwarf2out.c:60:
[...]/source-gcc/gcc/machmode.h: In function 'dw_loc_descr_node* mem_loc_descriptor(rtx, machine_mode, machine_mode, var_init_status)':
[...]/source-gcc/gcc/machmode.h:520:42: error: 'int_mode' may be used uninitialized in this function [-Werror=maybe-uninitialized]
520 | ? mode_size_inline (mode) : mode_size[mode]);
| ^~~~
[...]/source-gcc/gcc/dwarf2out.c:15464:19: note: 'int_mode' was declared here
15464 | scalar_int_mode int_mode, inner_mode, op1_mode;
| ^~~~~~~~
cc1plus: all warnings being treated as errors
make[3]: *** [dwarf2out.o] Error 1
Backport trunk r270903.
2019-05-06 Richard Biener <[email protected]>
* dwarf2out.c (mem_loc_descriptor): Initialize int_mode.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-9-branch@277608 138bc75d-0d04-0410-961f-82ee72b054a4
---
gcc/ChangeLog | 8 ++++++++
gcc/dwarf2out.c | 2 +-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 910887a8451..ce4630ba078 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2019-10-30 Thomas Schwinge <[email protected]>
+
+ Backport from trunk:
+
+ 2019-05-06 Richard Biener <[email protected]>
+
+ * dwarf2out.c (mem_loc_descriptor): Initialize int_mode.
+
2019-10-28 Uroš Bizjak <[email protected]>
PR target/92225
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 55a73e12cc2..ae47387b763 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -15461,7 +15461,7 @@ mem_loc_descriptor (rtx rtl, machine_mode mode,
if (mode != GET_MODE (rtl) && GET_MODE (rtl) != VOIDmode)
return NULL;
- scalar_int_mode int_mode, inner_mode, op1_mode;
+ scalar_int_mode int_mode = BImode, inner_mode, op1_mode;
switch (GET_CODE (rtl))
{
case POST_INC:
--
2.17.1
signature.asc
Description: PGP signature
