summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2008-12-05 16:52:16 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2008-12-05 16:52:16 +0000
commit0ef1a65121287b1ebc6c0afd0821e36980ca5eaa (patch)
tree9d62d6176a2544f214e82ea54ad9eedfeacc163e
parent4b546660693a9bb1a0d0c2d49a13dda2b0d5f82d (diff)
downloadppe42-gcc-0ef1a65121287b1ebc6c0afd0821e36980ca5eaa.tar.gz
ppe42-gcc-0ef1a65121287b1ebc6c0afd0821e36980ca5eaa.zip
PR middle-end/38338
* builtins.c (expand_builtin_apply_args): Put before parm_birth_insn only if internal_arg_pointer is a non-virtual pseudo. * gcc.dg/pr38338.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@142480 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/builtins.c10
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/pr38338.c18
4 files changed, 37 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index e42d80e9ecc..3882383678e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2008-12-05 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/38338
+ * builtins.c (expand_builtin_apply_args): Put before parm_birth_insn
+ only if internal_arg_pointer is a non-virtual pseudo.
+
2008-12-05 Joseph Myers <joseph@codesourcery.com>
* config/rs6000/rs6000.md (move_from_CR_gt_bit): Enable for
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 444baa606d1..4d507cf867c 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -1434,9 +1434,15 @@ expand_builtin_apply_args (void)
/* Put the insns after the NOTE that starts the function.
If this is inside a start_sequence, make the outer-level insn
chain current, so the code is placed at the start of the
- function. */
+ function. If internal_arg_pointer is a non-virtual pseudo,
+ it needs to be placed after the function that initializes
+ that pseudo. */
push_topmost_sequence ();
- emit_insn_before (seq, parm_birth_insn);
+ if (REG_P (crtl->args.internal_arg_pointer)
+ && REGNO (crtl->args.internal_arg_pointer) > LAST_VIRTUAL_REGISTER)
+ emit_insn_before (seq, parm_birth_insn);
+ else
+ emit_insn_before (seq, NEXT_INSN (entry_of_function ()));
pop_topmost_sequence ();
return temp;
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index d342035cc99..3853f975944 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2008-12-05 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/38338
+ * gcc.dg/pr38338.c: New test.
+
2008-12-05 Joseph Myers <joseph@codesourcery.com>
* gcc.target/powerpc/20081204-1.c: New test.
diff --git a/gcc/testsuite/gcc.dg/pr38338.c b/gcc/testsuite/gcc.dg/pr38338.c
new file mode 100644
index 00000000000..e8fcc3c4504
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr38338.c
@@ -0,0 +1,18 @@
+/* PR middle-end/38338 */
+/* { dg-options "-O0" } */
+/* { dg-options "-O0 -fPIC" { target fpic } } */
+
+typedef void (*fnp) (void);
+
+static char
+foo (char x)
+{
+ return x;
+}
+
+static void *
+bar (char x)
+{
+ void *args = __builtin_apply_args ();
+ return __builtin_apply ((fnp) foo, args, sizeof (void *));
+}
OpenPOWER on IntegriCloud