https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111849
kolten <koltenpearson at fastmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |koltenpearson at fastmail dot
com
--- Comment #3 from kolten <koltenpearson at fastmail dot com> ---
I just wanted to report an occurrence of this "in the wild". I was using the
arm-none-eabi-gcc packaged by alpine linux (version 15.2.0) for homebrew game
development for the gameboy advance, and it took me quite a while to realize
the bug I was seeing was due a struct assignment to a volatile memory mapped
struct was being optimized out. The fact that the volatile flags get dropped
when the memcpy is generated is unintuitive to say the least. Especially since
I get errors if I try to pass the same struct to a method I have written that
does not declare its struct parameter as volatile.
At the very least having a warning would be nice, it would have saved me a lot
of time vs silently discarding the volatile.