[Bug tree-optimization/55253] [4.8 Regression] Revision 193298 miscompiles sqlite with -Os
markus at trippelsdorf dot de
gcc-bugzilla@gcc.gnu.org
Sun Nov 11 09:22:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55253
--- Comment #1 from Markus Trippelsdorf <markus at trippelsdorf dot de> 2012-11-11 09:22:12 UTC ---
Reduced:
markus@x4 /tmp % cat test.i
struct
{
int mallocFailed;
}
*a;
struct StrAccum
{
int useMalloc;
}
b, c;
static void
fn1 (struct StrAccum *p1, int p2)
{
if (p2 == 0)
return;
if (p1->useMalloc)
a->mallocFailed = 0;
}
void
fn2 (struct StrAccum *p1)
{
fn1 (p1, 1);
}
void
fn3 (struct StrAccum *p1)
{
fn1 (p1, 1);
}
void
fn4 ()
{
c.useMalloc = 1;
fn1 (&c, 0);
}
int
main ()
{
fn3 (&b);
return 0;
}
markus@x4 /tmp % gcc -Os test.i && ./a.out
[1] 25665 segmentation fault ./a.out
markus@x4 /tmp % gcc -O2 test.i && ./a.out
markus@x4 /tmp %
More information about the Gcc-bugs
mailing list