https://gcc.gnu.org/bugzilla/show_bug.cgi?id=41244
--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Here are some better testcases as the power of 2 case can be handled on the rtl level as it is just a shift. extern struct s{ int a, b, c, d, e, f, g, h; } data[]; int find(int i, int j) { struct s *a = &data[i]; struct s *b = &data[j]; return a - b; } extern struct { int a, b, c; } data1[]; int find1(int i, int j) { return &data1[i] - data1; }