This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/39734] Misordering of instructions for short moves in a C program



------- Comment #4 from pinskia at gcc dot gnu dot org  2009-04-11 07:20 -------
    u_int32_t mask[1] = { 0xffffffff };
    u_int32_t cfg[1] = { 0x11111111 };

    u_int16_t *cfg16 = (u_int16_t *)cfg;
    u_int16_t *mask16 = (u_int16_t *)mask;

    printf("mask16[0]: 0x%04x\n", mask16[0]);

You are violating C/C++ aliasing rules as you are accessing a u_int32_t as a
u_int16_t.

*** This bug has been marked as a duplicate of 21920 ***


-- 

pinskia at gcc dot gnu dot org changed:

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


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]