This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/45462] Bad optimization in -O3 sometimes
- From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 31 Aug 2010 14:17:08 -0000
- Subject: [Bug c++/45462] Bad optimization in -O3 sometimes
- References: <bug-45462-19630@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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