struct A { int i; }; int foo(struct A *locp, int str) { int T355, *T356; T356 = &locp->i; *T356 = str; return locp->i; }
Confirmed.
Apparently something else _is_ folded. And a bit early too. We've already dropped to "T356<D1123> = (int<D0> *)locp<D1118>" even before gimplifying.
Actually I just fixed that yesterday.
Mine, I have a simple pass which does this.
Actually I got my tree combiner to do the work for me.
This shows up in PR 8361.
And here is a testcase for a missed optimization on the TREE level: void abort (void); struct a { int i; } *a; int f(void) { int *ii = &a->i; void *l; a->i = 1; if (*ii) l = &&l1; else l = &&l2; goto *l; l1: return 0; l2: abort (); }
Fixed with this patch: http://gcc.gnu.org/ml/gcc-patches/2005-05/msg01726.html