https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126405
--- Comment #9 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-16 branch has been updated by Kyrylo Tkachov <[email protected]>: https://gcc.gnu.org/g:7f1cdcfbf7a837b2ad14ebe2df04b01a178119f6 commit r16-9427-g7f1cdcfbf7a837b2ad14ebe2df04b01a178119f6 Author: Kyrylo Tkachov <[email protected]> Date: Sun Jul 26 03:18:46 2026 -0700 cfgexpand: Verify that partitions do not share a MEM_EXPR [PR126405] Two stack slots carrying one MEM_EXPR read as a single object to MEM_EXPR-based disambiguation. That is how PR121957, PR123625 and PR126405 each became wrong code: the load/store pair-fusion pass identifies a location by a MEM_EXPR base and an offset from it, so it fused accesses that belong to different slots and redirected a store. out-of-SSA maintains the invariant, but a break in it stays silent until some consumer acts on it, and only for the subset of functions that consumer happens to look at. Check it directly once per function under flag_checking, after every partition has been given its RTL, so that a regression here is an ICE rather than a miscompile. Bootstrapped and tested on aarch64-none-linux-gnu and x86_64-linux-gnu. gcc/ChangeLog: PR middle-end/126405 * cfgexpand.cc (verify_partition_mem_exprs): New function. (pass_expand::execute): Call it. Signed-off-by: Kyrylo Tkachov <[email protected]> (cherry picked from commit 95ee9c9e74eb93414bbcd76b02e1fcbec383f2ce)
