------- Comment #4 from jakub at gcc dot gnu dot org 2007-08-28 14:55 ------- On the trunk I'm just seeing *** in database main *** Page 2 is never used That seems to be because of miscompiled sqlite3SelectNew function with -O2 -fstrict-aliasing, with -O2 -fno-strict-aliasing that works.
Here is a reduced self-contained testcase for that: extern void abort (void); struct S { void *s1; unsigned char s2, s3, s4, s5, s6, s7; char s8; void *s9, *s10, *s11, *s12, *s13; struct S *s14, *s15; void *s16, *s17; int s18, s19, s20[3]; }; __attribute__((noinline)) void *foo (int x, int y) { static struct S s; if (x != sizeof (struct S) || y != 1) abort (); return &s; } __attribute__((noinline)) void bar (struct S *p) { asm volatile ("" : "=m" (*p) : "m" (*p)); } __attribute__((noinline)) void *baz1 (void *x, void *y,void *z) { if (y || z) abort (); return x; } __attribute__((noinline)) void *baz2 (int x, void *y, void *z, void *a) { if (x || y || z || a) abort (); return (void *) 0; } __attribute__((noinline)) struct S *test (void *a, void *b, void *c, void *d, void *e, void *f, int g, void *h, void *i) { struct S *p, q; p = foo (sizeof (*p), 1); if (p == 0) { p = &q; __builtin_memset (p, 0, sizeof (*p)); } if (a == 0) a = baz1(0, baz2(107,0,0,0), 0); p->s1 = a; p->s9 = b; p->s10 = c; p->s11 = d; p->s12 = e; p->s13 = f; p->s3 = g; p->s2 = 110; p->s16 = h; p->s17 = i; p->s18 = -1; p->s19 = -1; p->s20[0] = -1; p->s20[1] = -1; p->s20[2] = -1; if (p == &q) { bar(p); p = 0; } return p; } int main (void) { int a; int b; struct S *z = test ((void *) &a, (void *) &b, 0, 0, 0, 0, 0, 0, 0); if (z == 0) abort (); if (z->s1 != (void *) &a || z->s2 != 110 || z->s3 || z->s4) abort (); if (z->s5 || z->s6 || z->s7 || z->s8) abort (); if (z->s9 != (void *) &b || z->s10 || z->s11 || z->s12) abort (); if (z->s13 || z->s14 || z->s15 || z->s16) abort (); if (z->s17 || z->s18 != -1 || z->s19 != -1) abort (); if (z->s20[0] != -1 || z->s20[1] != -1 || z->s20[2] != -1) abort (); return 0; } -- jakub at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|GCC 4.2.0 with -ftree-vrp |[4.2/4.3 regression] With - |miscompiles a single line of|ftree-vrp miscompiles a |code in SQLite |single line of code in | |SQLite http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32575