http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52395

--- Comment #8 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-02-27 
13:09:12 UTC ---
The main issue is, of course, that we re-write base of the LHS of the
assignments at all.

Index: gcc/tree-sra.c
===================================================================
--- gcc/tree-sra.c      (revision 184591)
+++ gcc/tree-sra.c      (working copy)
@@ -1480,6 +1480,10 @@ build_ref_for_offset (location_t loc, tr

   gcc_checking_assert (offset % BITS_PER_UNIT == 0);

+  if (offset == 0
+      && types_compatible_p (exp_type, TREE_TYPE (base)))
+    return unshare_expr (base);
+
   base = get_addr_base_and_unit_offset (base, &base_offset);

   /* get_addr_base_and_unit_offset returns NULL for references with a variable

or, instead of re-writing

  *__x_1(D) = D.2219;

to

  __x_1(D)->re = SR.1_11;
  __x_1(D)->im = SR.2_10;

re-write it to

  SR.3_12 = COMPLEX_EXPR <SR.1_11, SR.2_12>;
  *__x_1(D) = SR.3_12;

to avoid touching the non-replaced LHS.

Reply via email to