[Bug c++/82101] Uninitialized variable detection failed with variables in for loop
rguenth at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Sep 5 08:04:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82101
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |diagnostic,
| |missed-optimization
Status|UNCONFIRMED |NEW
Last reconfirmed| |2017-09-05
Blocks| |24639
Ever confirmed|0 |1
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Dup of some existing bug for sure. t looks like initialized to GCC on the
backedge:
<bb 3> [0.00%]:
# i_1 = PHI <i_5(2), i_8(4)>
# t_2 = PHI <t_6(D)(2), t_7(4)>
if (i_1 > 9)
goto <bb 5>; [0.00%]
else
goto <bb 4>; [0.00%]
<bb 4> [0.00%]:
t_7 = t_2;
i_8 = i_1 + 1;
goto <bb 3>; [0.00%]
but that gets later optimistically propagated away (the variable is dead
anyway)
and thus the late pass warning about maybe-uninitialized doesn't get here.
Now what is special here is that the uninit value is on the loop entry edge
so the early pass _could_ warn.
It also looks like we could improve on scoping here when re-writing into SSA.
t doesn't need a PHI node as the value is not live over the backedge.
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