https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69482
--- Comment #14 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-12 branch has been updated by Richard Biener <rgue...@gcc.gnu.org>: https://gcc.gnu.org/g:3fd1c1a8640bf84c32695531a3ed81d4338409aa commit r12-10905-g3fd1c1a8640bf84c32695531a3ed81d4338409aa Author: Richard Biener <rguent...@suse.de> Date: Mon Jan 9 12:46:28 2023 +0100 middle-end/69482 - not preserving volatile accesses The following addresses a long standing issue with not preserving accesses to non-volatile objects through volatile qualified pointers in the case that object gets expanded to a register. The fix is to treat accesses to an object with a volatile qualified access as forcing that object to memory. This issue got more exposed recently so it regressed more since GCC 11. PR middle-end/69482 * cfgexpand.cc (discover_nonconstant_array_refs_r): Volatile qualified accesses also force objects to memory. * gcc.target/i386/pr69482-1.c: New testcase. * gcc.target/i386/pr69482-2.c: Likewise. (cherry picked from commit a5a8242153d078f1ebe60f00409415da260a29ee)