[cfe-dev] Unions in the Clang Static Analyzer

Keno Fischer via cfe-dev cfe-dev at lists.llvm.org
Thu Mar 2 22:54:30 PST 2017


This behavior also differs between C and C++. For example, C has explicitly:

[N1570, Footnote 95]
If the member used to read the contents of a union object is not the
same as the member last used to store a value in the object, the
appropriate part of the object representation of the value is
reinterpreted as an object representation in the new type as described
in 6.2.6 (a process sometimes called ‘‘type punning’’). This might be
a trap representation.

where object representation is essentially what you'd get if you
memcpyed the value.



More information about the cfe-dev mailing list