[Bug target/89251] [2018-q4m] Wrong datatype optimization on bitfield

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Feb 9 08:38:00 GMT 2019


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89251

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Using a smaller than declared size for standard loads is a valid and well
defined optimization (sometimes those use less bandwidth, othertimes it is
better for alignment reasons).  The case you are running into is that you don't
want to use that kind of load.  You should not using bitfields directly and
really should be using volatile here.  Volatile definition is exactly what is
needed for hardware registers and IIRC is the real only working case for
volatile these days (the other working case is a variable that changes due to
an interrupt/signal).


More information about the Gcc-bugs mailing list