This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix __builtin_apply_args on some targets (PR middle-end/37323)


The builtin_apply_args sequence depends on internal_arg_pointer.
This is on some targets a virtual register, but on others a pseudo
initialized for it.  The builtin_apply_args sequence is unfortunately
emitted right after the very first note in the function, before
internal_arg_pointer is initialized.

The following patch instead puts it right before NOTE_INSN_FUNCTION_BEG.
Bootstrapped/regtested on x86_64-linux, tested and visually inspected
builtin-apply4.c also on i?86-linux, powerpc-linux and powerpc64-linux
and John David Anglin tested it on hppa64-hp-hpux11.11
and hppa-unknown-linux-gnu.  Ok for trunk?

2008-11-10  Jakub Jelinek  <>

	PR middle-end/37323
	* builtins.c (expand_builtin_apply_args): Emit sequence before
	parm_birth_insn instead of after entry_of_function's first insn.

--- gcc/builtins.c.jj	2008-11-03 11:15:08.000000000 +0100
+++ gcc/builtins.c	2008-11-09 11:50:35.000000000 +0100
@@ -1432,7 +1432,7 @@ expand_builtin_apply_args (void)
        chain current, so the code is placed at the start of the
        function.  */
     push_topmost_sequence ();
-    emit_insn_before (seq, NEXT_INSN (entry_of_function ()));
+    emit_insn_before (seq, parm_birth_insn);
     pop_topmost_sequence ();
     return temp;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]