On Sat, 17 Dec 2011, Martin Jambor wrote:

> Hi,
> 
> when I was fixing PR 50622, somehow I lost a hunk in the patch along
> the way.  I punished myself by making up an ICEing testcase which is
> included alongside the fix below.  The fix is needed for trunk and
> also in the 4.6 branch.
> 
> I have bootstrapped and tested the patch on x86_64-linux on top of
> trunk without any problems, a bootstrap and testsuite run on top of
> the 4.6 branch is currently running.  OK for both if it passes?

Ok.

Thanks,
Richard.

> Thanks,
> 
> Martin
> 
> 
> 2011-12-16  Martin Jambor  <mjam...@suse.cz>
> 
>       PR tree-optimization/51583
>       * tree-sra.c (load_assign_lhs_subreplacements): Call
>       force_gimple_operand_gsi when necessary also in case of no
>       corresponding replacement on the RHS.
> 
>       * testsuite/gcc.dg/tree-ssa/pr51583.c: New test.
> 
> Index: src/gcc/tree-sra.c
> ===================================================================
> --- src.orig/gcc/tree-sra.c
> +++ src/gcc/tree-sra.c
> @@ -2752,6 +2752,9 @@ load_assign_lhs_subreplacements (struct
>             else
>               rhs = build_ref_for_model (loc, top_racc->base, offset, lacc,
>                                           new_gsi, true);
> +           if (lacc->grp_partial_lhs)
> +             rhs = force_gimple_operand_gsi (new_gsi, rhs, true, NULL_TREE,
> +                                             false, GSI_NEW_STMT);
>           }
>  
>         stmt = gimple_build_assign (get_access_replacement (lacc), rhs);
> Index: src/gcc/testsuite/gcc.dg/tree-ssa/pr51583.c
> ===================================================================
> --- /dev/null
> +++ src/gcc/testsuite/gcc.dg/tree-ssa/pr51583.c
> @@ -0,0 +1,34 @@
> +/* { dg-do compile } */
> +/* { dg-options "-O1" } */
> +
> +typedef __complex__ double Value;
> +
> +union U
> +{
> +  Value v;
> +  char c[sizeof(Value)];
> +};
> +
> +struct S
> +{
> +  union U u;
> +  int i,j;
> +};
> +
> +Value gv;
> +int gi, gj;
> +
> +Value foo (void)
> +{
> +  struct S s,t;
> +
> +  t.i = gi;
> +  t.j = gj;
> +  t.u.v = gv;
> +  t.u.c[0] = 0;
> +
> +  s = t;
> +  __imag__ s.u.v += s.i;
> +
> +  return s.u.v;
> +}
> 
> 

-- 
Richard Guenther <rguent...@suse.de>
SUSE / SUSE Labs
SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer

Reply via email to