]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR target/40031 (ARM broken with addresses in PHIs with -fPIC)
authorMichael Matz <matz@suse.de>
Sun, 10 May 2009 18:40:16 +0000 (18:40 +0000)
committerMichael Matz <matz@gcc.gnu.org>
Sun, 10 May 2009 18:40:16 +0000 (18:40 +0000)
        PR target/40031
        * config/arm/arm.c (require_pic_register): Emit on entry
        edge, not at entry of function.
testsuite/
        * gcc.dg/pr40031.c: New test.

From-SVN: r147350

gcc/ChangeLog
gcc/config/arm/arm.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr40031.c [new file with mode: 0644]

index 6c0177b65554c37545b1555cf4e41cab281b9647..4c6540a8ae043fbfc9fce4c67550de5ee69a361c 100644 (file)
@@ -1,3 +1,9 @@
+2009-05-10  Michael Matz  <matz@suse.de>
+
+       PR target/40031
+       * config/arm/arm.c (require_pic_register): Emit on entry edge,
+       not at entry of function.
+
 2009-05-10  Richard Guenther  <rguenther@suse.de>
 
        PR tree-optimization/40081
index 9264760908129f610a9c9202d96e65f5b133b069..1d9b42658438227d23a75ccaf3c8a71ce709d16c 100644 (file)
@@ -3596,7 +3596,11 @@ require_pic_register (void)
 
              seq = get_insns ();
              end_sequence ();
-             emit_insn_after (seq, entry_of_function ());
+             /* We can be called during expansion of PHI nodes, where
+                we can't yet emit instructions directly in the final
+                insn stream.  Queue the insns on the entry edge, they will
+                be committed after everything else is expanded.  */
+             insert_insn_on_edge (seq, single_succ_edge (ENTRY_BLOCK_PTR));
            }
        }
     }
index 017cbf4cfd070dd47db1f6dae1310913aa93909e..e0e92ce27dc43d4f8a405874c52608392bf87c86 100644 (file)
@@ -1,3 +1,8 @@
+2009-05-10  Michael Matz  <matz@suse.de>
+
+       PR target/40031
+       * gcc.dg/pr40031.c: New test.
+
 2009-05-10  Paul Thomas  <pault@gcc.gnu.org>
 
        PR fortran/40018
diff --git a/gcc/testsuite/gcc.dg/pr40031.c b/gcc/testsuite/gcc.dg/pr40031.c
new file mode 100644 (file)
index 0000000..f6f1f65
--- /dev/null
@@ -0,0 +1,9 @@
+/* { dg-do compile { target fpic } } */
+/* { dg-options "-O2 -fPIC" } */
+double c;
+double d;
+double *f(int a)
+{
+  if(a) return &c;
+  return &d;
+}