[llvm-dev] GCC 5 and -Wstrict-aliasing in JSON.h
Andrew Haley via llvm-dev
llvm-dev at lists.llvm.org
Tue Aug 14 02:51:16 PDT 2018
On 08/12/2018 02:19 PM, Kim Gräsman wrote:
> I still feel a little uncomfortable, because I think Jonathan makes an
> excellent point -- if GCC thinks there's a strict-aliasing violation
> (whether the standard agrees or not) and classifies this as undefined
> behavior, we might invoke the optimizers wrath. The warning is a nice
> hint that this could happen.
Indeed. And I'm not convinced that the pointer cast is necessary anyway:
if the type passed in is a union, why not simply take the union member of
the appropriate type?
I don't think that GCC would produce this warning unnecessarily. You
are in dangerous waters.
--
Andrew Haley
Java Platform Lead Engineer
Red Hat UK Ltd. <https://www.redhat.com>
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671
More information about the llvm-dev
mailing list