From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 109154 invoked by alias); 7 Apr 2017 08:01:08 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 109136 invoked by uid 89); 7 Apr 2017 08:01:08 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx2.suse.de Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 07 Apr 2017 08:01:06 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 80A75AC19; Fri, 7 Apr 2017 08:01:05 +0000 (UTC) Date: Fri, 07 Apr 2017 08:01:00 -0000 From: Richard Biener To: Florian Weimer cc: Bernd Edlinger , Jakub Jelinek , Jonathan Wakely , GCC Patches , Jason Merrill , Jeff Law Subject: Re: [PATCH] Add a new type attribute always_alias (PR79671) In-Reply-To: <59cad987-433b-dcb2-13d9-e23bb8d8912a@redhat.com> Message-ID: References: <20170405160333.GR4425@redhat.com> <20170405160849.GV17461@tucnak> <20170406075104.GA17461@tucnak> <7d17b3b7-2d38-6184-8bd6-eb9f96f87912@redhat.com> <50936a77-870a-5156-1f5e-b1e0327498b6@redhat.com> <7FF41E4E-8C71-431D-A955-BED818241913@suse.de> <59cad987-433b-dcb2-13d9-e23bb8d8912a@redhat.com> User-Agent: Alpine 2.20 (LSU 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-SW-Source: 2017-04/txt/msg00350.txt.bz2 On Fri, 7 Apr 2017, Florian Weimer wrote: > On 04/06/2017 09:16 PM, Richard Biener wrote: > > On April 6, 2017 8:12:29 PM GMT+02:00, Bernd Edlinger > > wrote: > > > But isn't the effective type changed by the assignment b[1] = 0; > > > as described in 6.5(6): > > > "If a value is stored into an object having no declared type through an > > > lvalue having a type that is not a character type, then the type of the > > > lvalue becomes the effective type of the object for that access and for > > > subsequent accesses that do not modify the stored value." > > > > Yes. I think the example is valid. At least GCCs memory model makes it so. > > As far as I understand the standard, C does not permit changing the effective > type of an object if it has a declared type (at least not without a union). > If GCC supports it, that's an undocumented GCC extension. The GCC middle-end supports it because C++ supports it and there is no way for the C FE to tell the middle-end that this is not valid. Richard.