This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC, PR 80689] Copy small aggregates element-wise


> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]