This is the mail archive of the gcc-patches@gcc.gnu.org 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]

Committed: fix mmix-knuth-mmixware breakage: builtins.c:expand_builtin_apply_args_1.


Happy new year.

Refer to <URL:http://gcc.gnu.org/ml/gcc/2003-12/msg01425.html>.  Looking
at recent patches and the context of the breakage, there was an immediate
suspect for generating that invalid insn, a hunch which proved correct in
a gdb session.  In builtins.c:1.266, there was a copy_to_reg call for the
emit_move_insn source operand.  In 1.268 for STACK_GROWS_DOWNWARD targets,
whenever current_function_pretend_args_size is nonzero, emit_move_insn was
now called with a PLUS source.  That's a no-no: the emit_move_insn
function isn't fixing up generally invalid operands, nor is it supposed
to, resulting in an invalid insn being generated.  This patch calls
force_operand on that plus_constant adjustment, the proper procedure for
making sure something is a valid general operand(!) unless it's otherwise
known.  See also other emit_move_insn callers in builtins.c and elsewhere.

Bootstrapped & checked i686-pc-linux-gnu (though Ada and the Ada testsuite
is still not properly built and run in a make bootstrap && make check),
built and tested on mmix-knuth-mmixware, cris-axis-elf, no regressions.
Committed as obvious.

	* builtins.c (expand_builtin_apply_args_1) [STACK_GROWS_DOWNWARD]:
	Call force_operand on plus_constant result.

Index: builtins.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/builtins.c,v
retrieving revision 1.268
diff -p -c -r1.268 builtins.c
*** builtins.c	30 Dec 2003 13:50:43 -0000	1.268
--- builtins.c	1 Jan 2004 15:35:26 -0000
*************** expand_builtin_apply_args_1 (void)
*** 1128,1135 ****
    tem = copy_to_reg (virtual_incoming_args_rtx);
  #ifdef STACK_GROWS_DOWNWARD
    /* We need the pointer as the caller actually passed them to us, not
!      as we might have pretended they were passed.  */
!   tem = plus_constant (tem, current_function_pretend_args_size);
  #endif
    emit_move_insn (adjust_address (registers, Pmode, 0), tem);

--- 1128,1138 ----
    tem = copy_to_reg (virtual_incoming_args_rtx);
  #ifdef STACK_GROWS_DOWNWARD
    /* We need the pointer as the caller actually passed them to us, not
!      as we might have pretended they were passed.  Make sure it's a valid
!      operand, as emit_move_insn isn't expected to handle a PLUS.  */
!   tem
!     = force_operand (plus_constant (tem, current_function_pretend_args_size),
! 		     NULL_RTX);
  #endif
    emit_move_insn (adjust_address (registers, Pmode, 0), tem);


brgds, H-P


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