https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113630
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2024-01-27 Ever confirmed|0 |1 Known to work|5.1.0, 6.1.0, 6.4.0 | --- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Confirmed. I really think what PRE does is correct here since we have an aliasing set of 0 for both. Now what is incorrect is hoist_adjacent_loads which cannot do either of any of the aliasing sets are 0 ... I think even the function below is valid for non-strict aliasing: ``` int __attribute__((noipa,noinline)) f(struct S *p, int c, int d) { int r; if (c) { r = ((struct M*)p)->a; } else r = ((struct M*)p)->b; return r; } ``` That is hoist_adjacent_loads is broken for non-strict-aliasing in general and has been since 4.8.0 when it was added (r0-117275-g372a6eb8d991eb).