RS6000 patch, fix PR17052

Alan Modra amodra@bigpond.net.au
Tue Aug 24 15:20:00 GMT 2004


sysv_varargs_p was being used before it was set.  See the PR for more
detail.  Even if sysv_varargs_p worked properly, it would be redundant
now that we only support stdarg style variable argument functions.

	PR target/17052
	* config/rs6000/rs6000.h (machine_function): Remove sysv_varargs_p.
	* config/rs6000/sysv4.h (RS6000_VARARGS_AREA): Use
	current_function_stdarg in place of sysv_varargs_p.
	* config/rs6000/rs6000.c (setup_incoming_varargs): Don't set
	sysv_varargs_p.

Bootstrapped powerpc-linux and powerpc64-linux.  Regression tests in
progress.  OK to apply assuming no regressions?

diff -urp -xCVS -x'*~' gcc-virgin/gcc/config/rs6000/rs6000.h gcc-current/gcc/config/rs6000/rs6000.h
--- gcc-virgin/gcc/config/rs6000/rs6000.h	2004-08-21 09:48:41.000000000 +0930
+++ gcc-current/gcc/config/rs6000/rs6000.h	2004-08-24 09:53:38.649815963 +0930
@@ -1647,8 +1642,6 @@ extern enum rs6000_abi rs6000_current_ab
    This is added to the cfun structure.  */
 typedef struct machine_function GTY(())
 {
-  /* Whether a System V.4 varargs area was created.  */
-  int sysv_varargs_p;
   /* Flags if __builtin_return_address (n) with n >= 1 was used.  */
   int ra_needs_full_frame;
   /* Some local-dynamic symbol.  */
diff -urp -xCVS -x'*~' gcc-virgin/gcc/config/rs6000/sysv4.h gcc-current/gcc/config/rs6000/sysv4.h
--- gcc-virgin/gcc/config/rs6000/sysv4.h	2004-08-21 09:48:41.000000000 +0930
+++ gcc-current/gcc/config/rs6000/sysv4.h	2004-08-24 09:53:37.192046775 +0930
@@ -332,7 +332,7 @@ do {									\
 /* Size of the V.4 varargs area if needed.  */
 /* Override rs6000.h definition.  */
 #undef	RS6000_VARARGS_AREA
-#define RS6000_VARARGS_AREA ((cfun->machine->sysv_varargs_p) ? RS6000_VARARGS_SIZE : 0)
+#define RS6000_VARARGS_AREA (current_function_stdarg ? RS6000_VARARGS_SIZE : 0)
 
 /* Override default big endianism definitions in rs6000.h.  */
 #undef	BYTES_BIG_ENDIAN
diff -urp -xCVS -x'*~' gcc-virgin/gcc/config/rs6000/rs6000.c gcc-current/gcc/config/rs6000/rs6000.c
--- gcc-virgin/gcc/config/rs6000/rs6000.c	2004-08-21 09:48:41.000000000 +0930
+++ gcc-current/gcc/config/rs6000/rs6000.c	2004-08-24 09:53:42.399222309 +0930
@@ -5300,8 +5299,6 @@ setup_incoming_varargs (CUMULATIVE_ARGS 
 
   if (DEFAULT_ABI == ABI_V4)
     {
-      /* Indicate to allocate space on the stack for varargs save area.  */
-      cfun->machine->sysv_varargs_p = 1;
       if (! no_rtl)
 	save_area = plus_constant (virtual_stack_vars_rtx,
 				   - RS6000_VARARGS_SIZE);
@@ -5312,7 +5309,6 @@ setup_incoming_varargs (CUMULATIVE_ARGS 
     {
       first_reg_offset = next_cum.words;
       save_area = virtual_incoming_args_rtx;
-      cfun->machine->sysv_varargs_p = 0;
 
       if (targetm.calls.must_pass_in_stack (mode, type))
 	first_reg_offset += rs6000_arg_size (TYPE_MODE (type), type);

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre



More information about the Gcc-patches mailing list