[Bug sanitizer/99945] missing maybe-uninitialized warning when using a cleanup function
msebor at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Apr 7 00:09:29 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99945
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Component|c |sanitizer
CC| |dodji at gcc dot gnu.org,
| |dvyukov at gcc dot gnu.org,
| |jakub at gcc dot gnu.org,
| |kcc at gcc dot gnu.org,
| |marxin at gcc dot gnu.org,
| |msebor at gcc dot gnu.org
Last reconfirmed| |2021-04-07
Blocks| |24639
Keywords| |diagnostic
--- Comment #4 from Martin Sebor <msebor at gcc dot gnu.org> ---
Confirmed. The warning sees the IL below. It's not the same as pr83382
because there's no call to a UBSAN function. The warning here is due to a
direct use of a GCC-internal variable (introduced in tree-nested.c). The
variable has the DECL_ARTIFICIAL bit set, so maybe also disabling the warning
for variables with that bit might make sense. OTOH, its seems like the use of
an unintialized variable shouldn't be emitted at all so that might be something
to look into first.
int bar ()
{
struct FRAME.bar FRAME.1;
int _1;
int _2;
int prephitmp_3;
void * _7;
int _11;
int pretmp_19;
int _21;
_Bool _22;
int _23;
<bb 2> [local count: 1073741824]:
# .MEM_6 = VDEF <.MEM_5(D)>
_7 = __builtin_dwarf_cfa (0);
# .MEM_8 = VDEF <.MEM_6>
FRAME.1.FRAME_BASE.PARENT = _7;
# .MEM_9 = VDEF <.MEM_8>
_1 = foo1 ();
if (_1 != 0)
goto <bb 4>; [33.00%]
else
goto <bb 3>; [67.00%]
<bb 3> [local count: 719407024]:
# VUSE <.MEM_9>
pretmp_19 = FRAME.1.i; <<< -Wmaybe-uninitialized
goto <bb 5>; [100.00%]
<bb 4> [local count: 354334800]:
# .MEM_10 = VDEF <.MEM_9>
_11 = foo1 ();
<bb 5> [local count: 1073741824]:
# .MEM_4 = PHI <.MEM_9(3), .MEM_10(4)>
# prephitmp_3 = PHI <pretmp_19(3), _11(4)>
# .MEM_13 = VDEF <.MEM_4>
_2 = foo1 ();
_21 = _2 | prephitmp_3;
_22 = _21 != 0;
_23 = (int) _22;
# .MEM_15 = VDEF <.MEM_13>
FRAME.1.i = _23;
# .MEM_16 = VDEF <.MEM_15>
foo2 (_23);
# .MEM_17 = VDEF <.MEM_16>
.UBSAN_NULL (&FRAME.1, 3B, 8);
# .MEM_18 = VDEF <.MEM_17>
foo2 (_23);
# VUSE <.MEM_18>
return 0;
}
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=24639
[Bug 24639] [meta-bug] bug to track all Wuninitialized issues
More information about the Gcc-bugs
mailing list