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: PR target/31989: [4.3 regression]: Gcc miscompiles C/C++ on Linux/x86-64

This patch


-  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:

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.

2007-05-18  H.J. Lu  <>

	PR target/31989
	* config/i386/i386.c (type_has_variadic_args_p): Return true if
	there is 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:17:42.000000000 -0700
@@ -2898,7 +2898,7 @@ type_has_variadic_args_p (tree type)
   tree n, t = TYPE_ARG_TYPES (type);
   if (t == NULL)
-    return false;
+    return true;
   while ((n = TREE_CHAIN (t)) != NULL)
     t = n;

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