https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113980
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Basically GCC does not optimize around a volatile memory load/stores which causes artifacts like this.
pinskia at gcc dot gnu.org via Gcc-bugs Sun, 18 Feb 2024 10:30:09 -0800
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113980
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Basically GCC does not optimize around a volatile memory load/stores which causes artifacts like this.