[Bug middle-end/71762] New: [4.9 Regression] ifcombine wrong codegen with uninitialized data
ibuclaw at gdcproject dot org
gcc-bugzilla@gcc.gnu.org
Mon Jul 4 22:19:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71762
Bug ID: 71762
Summary: [4.9 Regression] ifcombine wrong codegen with
uninitialized data
Product: gcc
Version: 4.9.4
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: ibuclaw at gdcproject dot org
Target Milestone: ---
In the following minimal test built with: g++ -O2
---
#include <stdio.h>
struct S
{
void* get()
{
return NULL;
}
~S()
{
printf("dtor\n");
}
};
void foo(void* x)
{
printf("foo\n");
}
void testFunc(int len)
{
bool __cond59;
bool __cond60;
foo ((__cond60 = len > 1, __cond60) ? NULL : (__cond59 = len == 1, __cond59)
? S().get() : NULL);
if (!__cond60)
{
if (__cond59)
{
printf("fail\n");
}
}
}
void check(void (*dg)(int))
{
dg(2);
}
int main()
{
check(&testFunc);
}
---
The optimizer simplifies the two if statements as: `if (__cond59 > __cond60)`,
where __cond59 is never initialized in `testFunc`.
This regression is only present in 4.9. gcc-4.8 and gcc-5 are unaffected.
The commit that caused the regression was r204194, and it went away after
r217496.
More information about the Gcc-bugs
mailing list