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: [PATCH] Fix small structure passing on x86-64


> > the test here is still bit confused.  It should test if the whole array
> > fits in lower 4 bytes that would be somehting like
> > (bit_offset + 7) / 8 + bytes <= 4
> 
> The change was the minimal one and this was done on purpose.  It's clear that 
> forcing a full word for 3 bytes is a little surprising, but that's what the 
> pre-existing code was doing.

Yes, I understand it. In fact I was just about to write mail that patch
is OK for stage3 and at stage1 we can make the test more tight, but
surprisingly we get many cases wrong:
struct S { char c; char arr[3];  } s;
will result in 8 byte read from s that might segfault.
struct S { char c; char arr[3]; double foo;  } s;
will get 64bit move for lower half that is suboptimal
struct S { char arr[3]; } s;
needs to be generated using two moves since missaligned 32bit move will
read past end of buffer.

those are all generated by generic code...
> 
> > There are very intersting problems related to this and reading past end
> > of the structure possibly causing segfault.  I am working on more
> > complette patch.
> 
> Thanks.  The patch has already been applied on the mainline though.

I noticed that, it is not problem, since it is incremental improvement
anyway :)

Honza
> 
> -- 
> Eric Botcazou


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