This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Add a new type attribute always_alias (PR79671)
- From: Bernd Edlinger <bernd dot edlinger at hotmail dot de>
- To: Richard Biener <rguenther at suse dot de>, Jakub Jelinek <jakub at redhat dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Jason Merrill <jason at redhat dot com>, Marc Glisse <marc dot glisse at inria dot fr>, Jonathan Wakely <jwakely at redhat dot com>, Jeff Law <law at redhat dot com>
- Date: Wed, 5 Apr 2017 17:41:10 +0000
- Subject: Re: [PATCH] Add a new type attribute always_alias (PR79671)
- Authentication-results: sourceware.org; auth=none
- Authentication-results: suse.de; dkim=none (message not signed) header.d=none;suse.de; dmarc=none action=none header.from=hotmail.de;
- References: <AM4PR0701MB216292327A207737064C3CA3E40A0@AM4PR0701MB2162.eurprd07.prod.outlook.com> <20170405132832.GS17461@tucnak> <E33F8D97-47E5-4836-8633-D44406BDF10A@suse.de>
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
On 04/05/17 17:20, Richard Biener wrote:
>> Also, wonder if you need to mark all types containing such arrays,
>> if you couldn't just set that flag in C++ on unsigned char/std::byte
>> arrays (and on anything with that attribute), have that imply alias set
>> 0 on it and then let the rest of alias machinery handle aggregate types
>> containing such fields.
>
> Yes, I expected it to work like this (didn't look at the patch yet).
>
I want to allow *only* what the C++ standard requires or what Jason says
of course :), and not a single bit more, because it suppresses otherwise
correct optimizations.
So a struct with a std::byte member is not alias_set 0,
only the std::byte itself is, but an array of std::byte
is itself typeless_storage, and makes the whole structure
also typeless_storage, but that is not the usual way how
the alias machinery works, where such an attribute would not
propagate. Currently I think the C++ FE can do the propagation
when the type is declared. I would not imply that with the
typeless_storage attribute, because may_alias does not do that
either.
Bernd.