On 6/20/07 6:35 AM, Bokhanko, Andrey S wrote: > As I learned from experience, gcc always assume independence between memory > references in the following program: > > typedef struct { > int m1; > int m2; > } S1; > > void foo(S1 *p1, S1 *p2) { > ... = p1->m1; > ... = p2->m2; > } > > ...even if -fno-strict-aliasing (an option disabling ansi-aliasing rules) > supplied.
No, it doesn't. Both p1->m1 and p2->m2 will use the same memory tag in GIMPLE and the same alias set during RTL. Notice how a store between the two loads affects the second load: # VUSE <SMT.4_7(D)> x_2 = p1_1(D)->m1; # SMT.4_8 = VDEF <SMT.4_7(D)> p1_1(D)->m1 = 32; # VUSE <SMT.4_8> y_4 = p2_3(D)->m2; Or did you mean that p1 and p2 should *not* interfere with each other?