https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98255
--- Comment #10 from Martin Jambor <jamborm at gcc dot gnu.org> --- OK, adding an additional check whether tree_could_trap_p is of course easy. I'll wait a little while if the discussion about get_ref_base_and_extent perhaps leads to a different solution but if not, I will prepare a patch. Also, please disregard my comment #7, even though it shows that SRA can do better by folding away the reference (and that works), it only shows that fold_const_aggregate_ref can deal with simple MEM_REFs with sane offsets, not arrays into strings with negative index.