https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127858
--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-16 branch has been updated by Richard Biener <[email protected]>: https://gcc.gnu.org/g:a4834d9e504ed1c669d8a599413ebcea2cd24b51 commit r16-9862-ga4834d9e504ed1c669d8a599413ebcea2cd24b51 Author: Richard Biener <[email protected]> Date: Tue Oct 13 15:28:09 2026 +0200 tree-optimization/127858 - fix memory access canonicalization in LIM When we canonicalize a memory access we merge accesses with differing access paths to a plain MEM_REF, but when there is a previous access with an access path we fail to clear the ao_refs base and offset. PR tree-optimization/127858 * tree-ssa-loop-im.cc (gather_mem_refs_stmt): When merging accesses with differing access path always reset base and offset to the canonical form by re-using the already canonical ao_ref. * gcc.dg/torture/pr127858.c: New testcase. (cherry picked from commit c312eea008ebfefc946d51cd064adaaa0efe8fb0)
