struct X { int i; }; int __attribute__((noinline)) foo (struct X *p, int *q, int a, int b) { struct X x, y; if (a) p = &x; if (b) q = &x.i; else q = &y.i; *q = 1; return p->i; } extern void abort (void); int main() { if (foo((void *)0, (void *)0, 1, 1) != 1) abort (); return 0; }
is miscompiled (the store to *q is deleted as unused) because the SMT used for *p misses the x and y aliases as x and y are neither directly stored nor is their SMT (but only the aliasing SMT for int). -- Summary: [4.4 Regression] SMT aliases incomplete Product: gcc Version: 4.4.0 Status: UNCONFIRMED Keywords: wrong-code, alias Severity: normal Priority: P3 Component: middle-end AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: rguenth at gcc dot gnu dot org OtherBugsDependingO 38151 nThis: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38236