------- Comment #4 from jakub at gcc dot gnu dot org 2007-12-19 15:31 ------- extern void abort (void); extern void *memset (void *s, int c, __SIZE_TYPE__ n);
struct S { char s[25]; }; struct S *p; void __attribute__((noinline)) foo (struct S *x, int set) { int i; for (i = 0; i < sizeof (x->s); ++i) if (x->s[i] != 0) abort (); else if (set) x->s[i] = set; p = x; } int main () { struct S a; memset (&a.s, '\0', sizeof (a.s)); foo (&a, 0); struct S b = a; foo (&b, 1); b = a; b = *p; foo (&b, 0); return 0; } fails on the trunk too at -O2 (succeeds with -O2 -fno-tree-dse). Here we have: # VUSE <aD.1560_18> { aD.1560 } # bD.1561_21 = VDEF <bD.1561_19> { bD.1561 } bD.1561 = aD.1560; # VUSE <pD.1547_17> { pD.1547 } p.2D.1562_1 = pD.1547; # VUSE <aD.1560_18, SMT.28D.1593_20> { aD.1560 bD.1561 SMT.28D.1593 } # bD.1561_22 = VDEF <bD.1561_21> { bD.1561 } bD.1561 = *p.2D.1562_1; at dce4. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34459