This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/65892] gcc fails to implement N685 aliasing of union members
- From: "davmac at davmac dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 01 May 2018 15:26:39 +0000
- Subject: [Bug c/65892] gcc fails to implement N685 aliasing of union members
- Auto-submitted: auto-generated
- References: <bug-65892-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65892
--- Comment #58 from Davin McCall <davmac at davmac dot org> ---
(In reply to Andrew Haley from comment #57)
> (In reply to Davin McCall from comment #52)
> > (In reply to Andrew Haley from comment #45)
> > > (In reply to Davin McCall from comment #44)
> > > > The "one special guarantee" clause appears in the section describing union
> > > > member access via the "." or "->" operators, implying that it only applies
> > > > to the access of union members via the union.
> > >
> > > I don't believe that's what is intended, or that you can make such a
> > > conclusion based on the section in which the rule appears. It applies
> > > to other accesses too, as is (somewhat) made clear by the rationale in
> > > http://www.open-std.org/jtc1/sc22/wg14/www/docs/n685.htm:
> >
> > It certainly may not be what is intended by N685, but I think it's normally
> > reasonable to conclude that a statement in a particular section of a
> > document applies to that section and not more universally than that; in this
> > case, the "universal" interpretation flatly contradicts the strict aliasing
> > rule and any other rule which would otherwise disallow access, which seems
> > extremely problematic to me.
> >
> > In general it appears the committee have asserted that the "universal"
> > interpretation (which since N685 requires visibility of the union
> > declaration to be effective) is the correct one, but my argument
>
> ... doesn't really matter from a practical point of view, does it?
> That ship has sailed.
Well, if the amendment doesn't make sense, I'd say it matters from a practical
point of view, yes. It can always be amended again.
> > is that the actual text of the standard strongly implies something
> > different, and that the interpretation being pushed instead turns
> > another portion of the standard text into nonsense.
>
> I don't think that's it really does, but I think we're done.
I've laid it out as best as I can in comment #56, and certainly don't have more
to add.