This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: RFA and RFC: tweak -fstrict-aliasing docs, provide pointer-cast example
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: Hans-Peter Nilsson <hans-peter dot nilsson at axis dot com>
- Cc: gcc-patches at gcc dot gnu dot org, gcc at gcc dot gnu dot org
- Date: Tue, 24 Jun 2008 10:47:09 +0000 (UTC)
- Subject: Re: RFA and RFC: tweak -fstrict-aliasing docs, provide pointer-cast example
- References: <200806240144.m5O1iGvr006631@ignucius.se.axis.com>
On Tue, 24 Jun 2008, Hans-Peter Nilsson wrote:
> There's background in
> <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36593>. Neither
> Richi nor me could find the union-assignment "gcc extension" at
> a glance, probably because it's not an *extension* but an
> implementation-defined behavior, and actually duly documented as
> such. However, to cross-reference that section together with
And also explicitly described in a footnote added in C99 TC3:
15. Page 073, 6.5.2.3
Attach a new footnote to the words "named member" in paragraph 3:
*) If the member used to access 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.
The doc patch is OK. (I think "is not allowed" is misleading when
describing code that is compile-time valid but had undefined behavior if
executed, but feel free to put "has undefined behavior" in place of "might
not work" if you wish.)
--
Joseph S. Myers
joseph@codesourcery.com