public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* PATCH: PR target/31989: [4.3 regression]: Gcc miscompiles C/C++ on Linux/x86-64
@ 2007-05-18 17:31 H. J. Lu
  2007-05-18 18:02 ` H. J. Lu
  0 siblings, 1 reply; 3+ messages in thread
From: H. J. Lu @ 2007-05-18 17:31 UTC (permalink / raw)
  To: gcc-patches; +Cc: rth

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.


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

	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;

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: PATCH: PR target/31989: [4.3 regression]: Gcc miscompiles C/C++ on Linux/x86-64
  2007-05-18 17:31 PATCH: PR target/31989: [4.3 regression]: Gcc miscompiles C/C++ on Linux/x86-64 H. J. Lu
@ 2007-05-18 18:02 ` H. J. Lu
  2007-05-18 20:47   ` Richard Guenther
  0 siblings, 1 reply; 3+ messages in thread
From: H. J. Lu @ 2007-05-18 18:02 UTC (permalink / raw)
  To: gcc-patches; +Cc: rth

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)
     {

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: PATCH: PR target/31989: [4.3 regression]: Gcc miscompiles C/C++ on Linux/x86-64
  2007-05-18 18:02 ` H. J. Lu
@ 2007-05-18 20:47   ` Richard Guenther
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Guenther @ 2007-05-18 20:47 UTC (permalink / raw)
  To: H. J. Lu; +Cc: gcc-patches, rth

On 5/18/07, H. J. Lu <hjl@lucon.org> wrote:
> 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?

This is ok if it passes testing and cures the failures.

Thanks,
Richard.

> 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)
>      {
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-05-18 20:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-18 17:31 PATCH: PR target/31989: [4.3 regression]: Gcc miscompiles C/C++ on Linux/x86-64 H. J. Lu
2007-05-18 18:02 ` H. J. Lu
2007-05-18 20:47   ` Richard Guenther

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).