[Bug c/47796] The code to write to a bit_field data strucuture will be removed unexpectedly with gcc 4.5.1 -O2 option

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Feb 18 07:52:00 GMT 2011


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47796

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2011-02-18 05:52:18 UTC ---
You are violating C/C++ aliasing rules:
pData = (unsigned int *)pTmp;
        data = *pData;
        printf("data = 0x%x\n", data);

You access a tmp_t via an unsigned int which is undefined.



More information about the Gcc-bugs mailing list