+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
/* 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;
}
+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.
--- /dev/null
+/* 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 *));
+}