From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3560 invoked by alias); 6 Apr 2017 14:23:45 -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 602 invoked by uid 89); 6 Apr 2017 14:23:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-6.9 required=5.0 tests=BAYES_00,GIT_PATCH_1,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=Felix, Jane, felix, jane 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; Thu, 06 Apr 2017 14:23:38 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 0062DAC21; Thu, 6 Apr 2017 14:23:37 +0000 (UTC) Date: Thu, 06 Apr 2017 14:23: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: <7d17b3b7-2d38-6184-8bd6-eb9f96f87912@redhat.com> Message-ID: References: <6a5109d6-81fb-c36c-e525-b2ed984760dc@redhat.com> <21E940B5-C8C4-4A86-8C15-49A86547DD87@suse.de> <20170405160333.GR4425@redhat.com> <20170405160849.GV17461@tucnak> <20170406075104.GA17461@tucnak> <7d17b3b7-2d38-6184-8bd6-eb9f96f87912@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/msg00299.txt.bz2 On Thu, 6 Apr 2017, Florian Weimer wrote: > On 04/06/2017 04:11 PM, Bernd Edlinger wrote: > > > I think it is not too complicated to done in the C++ FE. > > The FE looks for array of std::byte and unsigned char, > > and sets the attribute when the final type is constructed. > > > > What I am trying to do is just extend the semantic of may_alias > > a bit, and then have the C++ FE use it in the way it has to. > > We also need this for some POSIX and Linux kernel interfaces. A C++-only > solution would not help with that. Example(s)? > > Here is what I want to write in the doc: > > > > @item typeless_storage > > @cindex @code{typeless_storage} type attribute > > A type declared with this attribute behaves like a character type > > with respect to aliasing semantics. > > This is attribute is similar to the @code{may_alias} attribute, > > except that it is not restricted to pointers. > > As Jakub pointed out, this is not what we need here. An object of type char > does *not* have untyped storage. Accessing it as a different type is still > undefined. > > The documentation says that the memory region is considered to by untyped, > like a memory region returned by malloc (but obviously not with the > implication that the memory region is separated from everything else). > > Thanks, > Florian > > -- Richard Biener SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nuernberg)