[Bug c++/45462] Bad optimization in -O3 sometimes

rguenth at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Tue Aug 31 14:17:00 GMT 2010



------- Comment #3 from rguenth at gcc dot gnu dot org  2010-08-31 14:17 -------
 inline __attribute__((__always_inline__)) uint32 READ_UINT32(const void *ptr)
{
  struct Unaligned32 { uint32 val; } __attribute__ ((__packed__));
  return ((const Unaligned32 *)ptr)->val;
 }

and similar look like they might violate C aliasing rules.  Try using
-fno-strict-aliasing.


-- 


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



More information about the Gcc-bugs mailing list