From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 87494 invoked by alias); 9 Sep 2015 14:25:44 -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 85829 invoked by uid 48); 9 Sep 2015 14:25:40 -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:25: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/msg00732.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65892 --- Comment #15 from Jonathan Wakely --- (In reply to Melissa from comment #12) > A C++ conversion of the original example is below. I asked about the word > "read" on the C++ Standard Discussion (std-discussion) mailing list, because > it probably should also allow writing if it allows reads. Up to C++14 the wording said "inspect" which was changed to use "read" by http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1719 so I think limiting to reads and not writes is intended. (In reply to joseph@codesourcery.com from comment #14) > That C++ wording doesn't have any obvious bearing on what "it is > permitted" is intended to be an exception to - the general > implementation-defined nature of type punning (which I think was the > original intent in C90), or the aliasing rules. C++ doesn't support any type-punning, only reading from the common initial sequence (where the types must be compatible), so I think it can only be an exception to the aliasing rules.