From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 71314 invoked by alias); 9 Sep 2015 14:42:46 -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 70756 invoked by uid 48); 9 Sep 2015 14:42:42 -0000 From: "redi 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 14:42: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: redi 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/msg00734.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65892 --- Comment #16 from Jonathan Wakely --- Message [c++std-core-20893] on the C++ core reflector on 2011-12-14 supports the GCC view that a C++ compiler can apply strict aliasing rules to p1->m and p2->m unless the fact they come from the same object is visible to the compiler. | Either I'm mistaken, or it is a 'magical property of unions'. If the | compiler can figure out two objects didn't come form the same union, | it can assume they do not alias, Yes. I believe I filled a core issue regarding this -- coming from controversy originating from optimizations performed by compilers today (especially without full program analysis) -- and the resolution is that if intend to play type punning games with X and Y you better let the type checker and optimizer see your cards upfront. Otherwise, you are on your own. I can't remember the issue number right now. In the end, I think that was the right decision. But I can't find the core issue referred to.