https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84190
--- Comment #2 from Marc Glisse <glisse at gcc dot gnu.org> --- IIRC, the standard provides guarantees for volatile objects. Here, you are accessing a non-volatile object through a volatile type, and if the compiler can find out about the underlying object, it can ignore 'volatile'. At least I seem to remember discussions along those lines in the past.