From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 99403 invoked by alias); 9 Sep 2015 15:59:25 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 97654 invoked by uid 48); 9 Sep 2015 15:59:22 -0000 From: "msebor at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/65892] gcc fails to implement N685 aliasing of union members Date: Wed, 09 Sep 2015 15:59:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 5.0 X-Bugzilla-Keywords: alias X-Bugzilla-Severity: normal X-Bugzilla-Who: msebor at gcc dot gnu.org X-Bugzilla-Status: SUSPENDED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-09/txt/msg00739.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65892 --- Comment #17 from Martin Sebor --- The C Union Visibility rule was intended to cover that case. The trouble is that the rule tends to be interpreted differently by different people, users and implementers alike: Is it the union object that must be visible at the point of the access, or just the union type? Must the access be performed using the union object, or just the union type, or neither? There are implementations that apparently disable aliasing at the first sight of a union in a translation unit. There are others that only disable it for structs used in a union. And others still that don't do anything special unless the aliased object is accessed through the union itself. There are also aliasing problems beyond unions that affect both languages. WG14 N1520 referenced in comment #10 gives a few scary examples. This still needs to be resolved. (I haven't talked to Clark since Lenexa so unless he's made progress on the issue the new paper I mentioned in comment #10 will have to wait until 2016.)