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/67090] [5/6 Regression] O2/O3 optimizes values away when different type pointers are typecasted


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.

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