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/34552] optimization of bit-shifts leads to strange results



------- Comment #2 from pinskia at gcc dot gnu dot org  2007-12-22 05:38 -------
  uint32_t* foo = (uint32_t*)&z;

  zbuf[3] = ((*foo) & 0x000000ffL);

It is obvious you are violating C/C++ aliasing rules which leads to undefined
behavior.

Use either -fno-strict-aliasing, an union, or memcpy.


*** 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=34552


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