]> git.ipfire.org Git - thirdparty/gcc.git/commit
middle-end/69482 - not preserving volatile accesses
authorRichard Biener <rguenther@suse.de>
Mon, 9 Jan 2023 11:46:28 +0000 (12:46 +0100)
committerRichard Biener <rguenther@suse.de>
Mon, 9 Jan 2023 12:31:44 +0000 (13:31 +0100)
commita5a8242153d078f1ebe60f00409415da260a29ee
tree14727901463d84d5f0759cc663254cc77db12ce8
parentfb082e3293d45d928ae107d8f351b04be89d1bc2
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.
gcc/cfgexpand.cc
gcc/testsuite/gcc.target/i386/pr69482-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/pr69482-2.c [new file with mode: 0644]