Commit 66a0dfeb by Jim Wilson Committed by Jim Wilson

Fix -O3 stdarg miscompilation.

	* config/v850/v850.c (current_function_anonymous_args): Delete.
	(expand_prologue): Use current_function_args_info.anonymous_args.
	(expand_epilogue): Delete use of current_function_anonymous_args.
	* config/v850/v850.h (struct cum_arg): Add anonymous_args field.
	(INIT_CUMULATIVE_ARGS): Clear anonymous_args field.
	(current_function_anonymous_args): Delete extern declaration.
	(SETUP_INCOMING_VARARGS): Set anonymous_args field.

From-SVN: r57363
parent f51eee6a
2002-09-20 Jim Wilson <wilson@redhat.com>
* config/v850/v850.c (current_function_anonymous_args): Delete.
(expand_prologue): Use current_function_args_info.anonymous_args.
(expand_epilogue): Delete use of current_function_anonymous_args.
* config/v850/v850.h (struct cum_arg): Add anonymous_args field.
(INIT_CUMULATIVE_ARGS): Clear anonymous_args field.
(current_function_anonymous_args): Delete extern declaration.
(SETUP_INCOMING_VARARGS): Set anonymous_args field.
2002-09-20 Geoffrey Keating <geoffk@apple.com> 2002-09-20 Geoffrey Keating <geoffk@apple.com>
* config/rs6000/rs6000.c (rs6000_emit_prologue): Update for change * config/rs6000/rs6000.c (rs6000_emit_prologue): Update for change
...@@ -61,9 +61,6 @@ static void v850_encode_data_area PARAMS ((tree)); ...@@ -61,9 +61,6 @@ static void v850_encode_data_area PARAMS ((tree));
static void v850_encode_section_info PARAMS ((tree, int)); static void v850_encode_section_info PARAMS ((tree, int));
static const char *v850_strip_name_encoding PARAMS ((const char *)); static const char *v850_strip_name_encoding PARAMS ((const char *));
/* True if the current function has anonymous arguments. */
int current_function_anonymous_args;
/* Information about the various small memory areas. */ /* Information about the various small memory areas. */
struct small_memory_info small_memory[ (int)SMALL_MEMORY_max ] = struct small_memory_info small_memory[ (int)SMALL_MEMORY_max ] =
{ {
...@@ -1656,7 +1653,7 @@ expand_prologue () ...@@ -1656,7 +1653,7 @@ expand_prologue ()
} }
/* Save arg registers to the stack if necessary. */ /* Save arg registers to the stack if necessary. */
else if (current_function_anonymous_args) else if (current_function_args_info.anonymous_args)
{ {
if (TARGET_PROLOG_FUNCTION) if (TARGET_PROLOG_FUNCTION)
{ {
...@@ -2063,7 +2060,6 @@ Saved %d bytes via epilogue function (%d vs. %d) in function %s\n", ...@@ -2063,7 +2060,6 @@ Saved %d bytes via epilogue function (%d vs. %d) in function %s\n",
emit_jump_insn (gen_return ()); emit_jump_insn (gen_return ());
} }
current_function_anonymous_args = 0;
v850_interrupt_cache_p = FALSE; v850_interrupt_cache_p = FALSE;
v850_interrupt_p = FALSE; v850_interrupt_p = FALSE;
} }
......
...@@ -713,7 +713,7 @@ enum reg_class ...@@ -713,7 +713,7 @@ enum reg_class
such as FUNCTION_ARG to determine where the next arg should go. */ such as FUNCTION_ARG to determine where the next arg should go. */
#define CUMULATIVE_ARGS struct cum_arg #define CUMULATIVE_ARGS struct cum_arg
struct cum_arg { int nbytes; }; struct cum_arg { int nbytes; int anonymous_args; };
/* Define where to put the arguments to a function. /* Define where to put the arguments to a function.
Value is zero to push the argument on the stack, Value is zero to push the argument on the stack,
...@@ -739,7 +739,7 @@ struct cum_arg { int nbytes; }; ...@@ -739,7 +739,7 @@ struct cum_arg { int nbytes; };
For a library call, FNTYPE is 0. */ For a library call, FNTYPE is 0. */
#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \ #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \
((CUM).nbytes = 0) ((CUM).nbytes = 0, (CUM).anonymous_args = 0)
/* Update the data in CUM to advance over an argument /* Update the data in CUM to advance over an argument
of mode MODE and data type TYPE. of mode MODE and data type TYPE.
...@@ -758,10 +758,9 @@ struct cum_arg { int nbytes; }; ...@@ -758,10 +758,9 @@ struct cum_arg { int nbytes; };
space allocated by the caller. */ space allocated by the caller. */
#define OUTGOING_REG_PARM_STACK_SPACE #define OUTGOING_REG_PARM_STACK_SPACE
extern int current_function_anonymous_args;
/* Do any setup necessary for varargs/stdargs functions. */ /* Do any setup necessary for varargs/stdargs functions. */
#define SETUP_INCOMING_VARARGS(CUM, MODE, TYPE, PAS, SECOND) \ #define SETUP_INCOMING_VARARGS(CUM, MODE, TYPE, PAS, SECOND) \
current_function_anonymous_args = (!TARGET_GHS ? 1 : 0); (CUM).anonymous_args = (!TARGET_GHS ? 1 : 0);
/* Implement `va_arg'. */ /* Implement `va_arg'. */
#define EXPAND_BUILTIN_VA_ARG(valist, type) \ #define EXPAND_BUILTIN_VA_ARG(valist, type) \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment