------- Comment #7 from pinskia at gcc dot gnu dot org 2009-01-15 23:30 ------- PR 38747 has the best patch which allows most optimizations still but only disabling it for the invalid cases when the aliasing sets are not equal. Take: struct S { unsigned f; }; int __attribute__((noinline)) foo ( struct S *p) { int *q = (int *)&p->f; int i = *q; return i + p->f; }
We should be able to optimize this to just "tmp = p->f; return (int)(tmp + tmp);" which we do with my patch unlike the one in comment #2 which disables too many optimizations. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38748