[Bug middle-end/22456] [4.1/4.2/4.3 regression] missing "is used uninitialized" warning
rguenth at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Wed Apr 11 21:17:00 GMT 2007
------- Comment #11 from rguenth at gcc dot gnu dot org 2007-04-11 22:17 -------
Actually 22456 is CCP ignoring uninitialized vars on phi merging. Testcase:
int foo(int f)
{
int i;
if (f)
i = 5;
return i;
}
CCP makes it return 5, so the set of i and the PHI becomes dead. Before CCP
we have:
<bb 2>:
if (f_2(D) != 0) goto <L0>; else goto <L1>;
<L0>:;
i_4 = 5;
# i_1 = PHI <i_3(D)(2), i_4(3)>
<L1>:;
i_5 = i_1;
while CCP transforms it to
<bb 2>:
if (f_2(D) != 0) goto <L0>; else goto <L1>;
<L0>:;
i_4 = 5;
# i_1 = PHI <i_3(D)(2), 5(3)>
<L1>:;
i_5 = 5;
and the next DCE pass removes all but a return 5;
This can be fixed by making CCP not use undefined behavior.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22456
More information about the Gcc-bugs
mailing list