This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC, PR 80689] Copy small aggregates element-wise
- From: Eric Botcazou <ebotcazou at adacore dot com>
- To: Richard Biener <richard dot guenther at gmail dot com>
- Cc: gcc-patches at gcc dot gnu dot org, Michael Matz <matz at suse dot de>, Jan Hubicka <hubicka at ucw dot cz>
- Date: Tue, 14 Nov 2017 00:57:35 +0100
- Subject: Re: [RFC, PR 80689] Copy small aggregates element-wise
- Authentication-results: sourceware.org; auth=none
- References: <CAFiYyc3xY8+NQCRPRgKScN+bKtWPnFuJMF6xJC1PwE7=nbKOuA@mail.gmail.com> <alpine.LSU.2.21.1711131437330.25295@wotan.suse.de> <CAFiYyc1-QTCj48bDd8fBUD_ebjUmQ0wvYchZgauZWbyKGzAVUQ@mail.gmail.com>
> The chance here is, of course (find the PR, it exists...), that SRA then
> decomposes the char[] copy bytewise...
>
> That said, memcpy folding is easy to fix. The question is of course
> what the semantic of VIEW_CONVERTs is (SRA _does_ contain
> bail-outs on those). Like if you have
>
> struct A { short s; int i; } x;
> struct B { int i; short s; } y;
>
> void foo ()
> {
> x = VIEW_CONVERT <struct A> (y);
> }
>
> so can you access padding via view-converting its value? Ada uses
> VIEW_CONVERT punning on structures a _lot_ (probably the reason
> for the SRA bailout).
Couple of things:
1. We have been trying to get rid of VIEW_CONVERT as much as possible in the
Ada compiler for a number of years now.
2. Padding is garbage in Ada and thus its contents cannot have any effect on
the execution of legal programs (and SRA already killed any hope of preserving
padding a long time ago for not-so-legal programs anyway).
--
Eric Botcazou