------- Comment #9 from rguenth at gcc dot gnu dot org  2010-01-14 14:34 -------
Ugh.

  args = copy_list (args);

simple-minded copies all PARM_DECLs in the function - but of course the
actual functions parameter list is not adjusted, this is only a temporary
list used for parameter setup.

So

 1) remove that bogus target hook (and thus the copy_list call)

 2) make split_complex_args and its callers and all the consumers of the
    altered argument list use a VEC of PARM_DECLs instead of a chain
    of PARM_DECLs

assign_parms_unsplit_complex tries to fixup after the fact but obviously
misses both DECL_RTL and more important already generated instructions.

Thus, the following hack fixes the testcase - can you verify that?

Index: gcc/function.c
===================================================================
*** gcc/function.c      (revision 155904)
--- gcc/function.c      (working copy)
*************** assign_parms_unsplit_complex (struct ass
*** 3125,3130 ****
--- 3125,3132 ----
        }
        else
        {
+         rtx p;
+ 
          SET_DECL_RTL (parm, DECL_RTL (fnargs));
          set_decl_incoming_rtl (parm, DECL_INCOMING_RTL (fnargs), false);

*************** assign_parms_unsplit_complex (struct ass
*** 3132,3137 ****
--- 3134,3155 ----
             instead of the copy of decl, i.e. FNARGS.  */
          if (DECL_INCOMING_RTL (parm) && MEM_P (DECL_INCOMING_RTL (parm)))
            set_mem_expr (DECL_INCOMING_RTL (parm), parm);
+         if (MEM_P (DECL_RTL (parm)))
+           set_mem_expr (DECL_RTL (parm), parm);
+ 
+         /* Also fixup already generated RTL.  */
+         for (p = get_insns (); p; p = NEXT_INSN (p))
+           {
+             rtx x;
+             if ((x = single_set (p))
+                 && MEM_P (SET_DEST (x)))
+               {
+                 x = SET_DEST (x);
+                 if (MEM_EXPR (x)
+                     && MEM_EXPR (x) == fnargs)
+                   set_mem_expr (x, parm);
+               }
+           }
        }

        fnargs = TREE_CHAIN (fnargs);


-- 


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

Reply via email to