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]

Re: PATCH: PR target/31989: [4.3 regression]: Gcc miscompiles C/C++ on Linux/x86-64


On Fri, May 18, 2007 at 10:31:27AM -0700, H. J. Lu wrote:
> This patch
> 
> http://gcc.gnu.org/ml/gcc-patches/2007-03/msg01511.html
> 
> contains:
> 
> -  cum->maybe_vaarg = false;
> +  cum->maybe_vaarg = (fntype ? type_has_variadic_args_p (fntype) : !libname);
> 
> ...
> 
> -  if ((!fntype && !libname)
> -      || (fntype && !TYPE_ARG_TYPES (fntype)))
> -    cum->maybe_vaarg = true;
> 
> Please note that before the change, when TYPE_ARG_TYPES (fntype) was
> 0, cum->maybe_vaarg was set to true. However, the patch:
> 
> http://gcc.gnu.org/ml/gcc-patches/2007-04/msg01333.html
> 
> changed it to false and causes the regression. I am testing this
> patch to restore the old behavior for init_cumulative_args.  However,
> type_has_variadic_args_p is also called from ix86_return_pops_args
> and x86_this_parameter. I am not sure if it is really appropriate.
> 
> 

I blieve this is the correct patch to restore the previous behavior.
I am testing it on Linux/ia32 and Linux/x86-64 now. OK to install
if there is no regression?


H.J.
---
2007-05-18  H.J. Lu  <hongjiu.lu@intel.com>

	PR target/31989
	* config/i386/i386.c (init_cumulative_args): Set maybe_vaarg to
	true if function has no argument.

--- gcc/config/i386/i386.c.vararg	2007-05-18 07:22:24.000000000 -0700
+++ gcc/config/i386/i386.c	2007-05-18 10:57:05.000000000 -0700
@@ -3042,7 +3042,10 @@ init_cumulative_args (CUMULATIVE_ARGS *c
     cum->mmx_nregs = MMX_REGPARM_MAX;
   cum->warn_sse = true;
   cum->warn_mmx = true;
-  cum->maybe_vaarg = (fntype ? type_has_variadic_args_p (fntype) : !libname);
+  cum->maybe_vaarg = (fntype
+		      ? (!TYPE_ARG_TYPES (fntype)
+			 || type_has_variadic_args_p (fntype))
+		      : !libname);
 
   if (!TARGET_64BIT)
     {


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