https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89317
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |TREE --- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Note on the trunk, these two functions now produce the same code. BUT we are still missing a gimple level optimization. The RTL level can figure out: _1 = this_6(D) + 16; _2 = &this_6(D)->data1; _19 = _1 - _2; __n_20 = _19 /[ex] 2; if (_19 > 0) goto <bb 3>; [89.00%] else goto <bb 18>; [11.00%] That _19 is 16 and the condition is always true. Reduced testcase for that issue: struct { int data[16]; } *x; int foo (int n1) { int *a = x->data; int *b = ((int*)x) + 4; return b - a; }