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 PR tree-optimization/50569


On Sat, Dec 10, 2011 at 10:31 PM, Eric Botcazou <ebotcazou@adacore.com> wrote:
> Hi,
>
> this is a regression present on mainline and 4.6 branch at -O for the SPARC.
> The compiler again generates an unaligned access for the memcpy calls in:
>
> struct event {
> ? ?struct {
> ? ? ? ?unsigned int sec;
> ? ?} sent __attribute__((packed));
> };
>
> void __attribute__((noinline,noclone)) frob_entry(char *buf)
> {
> ? ?struct event event;
>
> ? ?__builtin_memcpy(&event, buf, sizeof(event));
> ? ?if (event.sent.sec < 64) {
> ? ? ? ?event.sent.sec = -1U;
> ? ? ? ?__builtin_memcpy(buf, &event, sizeof(event));
> ? ?}
> }
>
> Unsurprisingly enough, the trick used in build_ref_for_model (in case this is a
> reference to a component, the function will replicate the last COMPONENT_REF
> of model's expr to access it) isn't sufficient anymore with MEM_REFs around,
> since MEM_REFs can encapsulate an arbitrary number of inner references.
>
> Fixed by extending the trick to chain of COMPONENT_REFs. ?Tested on x86/Linux
> and SPARC/Solaris, OK for mainline and 4.6 branch?

Ok for both.

Thanks,
Richard.

>
> 2011-12-10 ?Eric Botcazou ?<ebotcazou@adacore.com>
>
> ? ? ? ?PR tree-optimization/50569
> ? ? ? ?* tree-sra.c (build_ref_for_model): Replicate a chain of COMPONENT_REFs
> ? ? ? ?in the expression of MODEL instead of just the last one.
>
>
> 2011-12-10 ?Eric Botcazou ?<ebotcazou@adacore.com>
>
> ? ? ? ?* gcc.c-torture/execute/20111210-1.c! New test.
>
>
> --
> Eric Botcazou


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