------- Comment #5 from rguenth at gcc dot gnu dot org  2010-02-23 11:51 -------
(In reply to comment #4)
> Can't reproduce this, at least not with a cross gcc (and -m32 -msecure-plt -O2
> -fPIC), on neither the original nor the reduced testcase.

Ok, there's a single ppc specific patch in our tree carried over from 4.1.
Maybe it's finally time to investigate why it's still there and if that is
the cause for this problem:

2005-11-28  Jakub Jelinek  <ja...@redhat.com>

        * config/rs6000/rs6000.c (rs6000_return_addr): If COUNT == 0,
        read word RETURN_ADDRESS_OFFSET bytes above arg_pointer_rtx
        instead of doing an extran indirection from frame_pointer_rtx.

        * gcc.dg/20051128-1.c: New test.

Index: gcc/config/rs6000/rs6000.c
===================================================================
--- gcc/config/rs6000/rs6000.c.orig     2009-10-26 11:13:21.000000000 +0100
+++ gcc/config/rs6000/rs6000.c  2009-11-18 14:59:12.000000000 +0100
@@ -17526,17 +17526,22 @@ rs6000_return_addr (int count, rtx frame
      don't try to be too clever here.  */
   if (count != 0 || (DEFAULT_ABI != ABI_AIX && flag_pic))
     {
+      rtx x;
       cfun->machine->ra_needs_full_frame = 1;

-      return
-       gen_rtx_MEM
-         (Pmode,
-          memory_address
-          (Pmode,
-           plus_constant (copy_to_reg
-                          (gen_rtx_MEM (Pmode,
-                                        memory_address (Pmode, frame))),
-                          RETURN_ADDRESS_OFFSET)));
+      if (count == 0)
+       {
+         gcc_assert (frame == frame_pointer_rtx);
+         x = arg_pointer_rtx;
+       }
+      else
+       {
+         x = memory_address (Pmode, frame);
+         x = copy_to_reg (gen_rtx_MEM (Pmode, x));
+       }
+
+      x = plus_constant (x, RETURN_ADDRESS_OFFSET);
+      return gen_rtx_MEM (Pmode, memory_address (Pmode, x));
     }

   cfun->machine->ra_need_lr = 1;


I'm also trying to reproduce it with a plain trunk cross-compiler.


-- 


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

Reply via email to