Ian Lance Taylor wrote: > Strict aliasing only refers to loads and stores using pointers.
skaller writes: > Ah, I see. So turning it off isn't really all that bad > for optimisation. One example of where it hurts on just about any platform is something like this: void allocate(int **p, unsigned len); int *foo(unsigned len) { int *p; unsigned i; allocate(&p, len); for (i = 0; i < len; i++) p[i] = 1; return p; } Without strict aliasing being enabled, the compiler can't assume that that the assignment "p[i] = 1" won't change "p". This results the value of p being loaded on every loop iteration, instead of just once at the start of the loop. It also prevents GCC from vectorizing the loop. On Itaninum CPUs speculative loads can be used instead of strict alias analysis to avoid this problem. Ross Ridge