https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98255
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> --- The return n[0][3][-2U]; access is UB in the program, so if it would be reached, it can do anything, but the important thing is that it is guarded with while (g) where g is always 0 during the exection of the program. The sra bug is that it hoists the n[0][3][-2U] read from where it was in the IL to the start of the function. That is perhaps fine for memory reads that can't trap (are within the bounds of the object), though even for those it might not be beneficial from optimization POV (higher register pressure), but for memory references for which tree_could_trap_p is true as in this case, they shouldn't be hoisted in the IL before their guarding condition.