https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94015
--- Comment #4 from Nate Eldredge <nate at thatsmathematics dot com> --- Comment on attachment 47959 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47959 gcc10-pr94015.patch I'm not qualified to opine on the proposed fix, but just wanted to note that, as I mentioned above, running your testcase doesn't actually exercise the bug on amd64/linux because the high byte of the address of the literal is always zero, so the test passes whether s[7]='\0' is "optimized" out or not. More tests are always good, I suppose, but I just want to emphasize that running this testcase is not the way to check whether the bug is fixed. I wasn't able to come up with a good runtime way to check whether the code was correctly compiled. Maybe someone more clever than me can think of a way?