This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/67090] [5/6 Regression] O2/O3 optimizes values away when different type pointers are typecasted
- From: "trippels at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 01 Aug 2015 18:33:33 +0000
- Subject: [Bug c/67090] [5/6 Regression] O2/O3 optimizes values away when different type pointers are typecasted
- Auto-submitted: auto-generated
- References: <bug-67090-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67090
Markus Trippelsdorf <trippels at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |trippels at gcc dot gnu.org
--- Comment #4 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
(In reply to DÄvis from comment #3)
> (In reply to Andrew Pinski from comment #2)
> > This is such an obvious violation of aliasing rules in c/c++.
> > Use memcpy or an Union (gcc extension) to get around the it. You can use
> > -fno-strict-aliasing too.
>
> Then warning (or error) would be more appropriate than silently generating
> invalid code as currently there's no warning even with -Wall
You'll get the warning with -Wstrict-aliasing=2 or -Wstrict-aliasing=1.