public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <rguenther@suse.de>
To: Jan Hubicka <hubicka@ucw.cz>
Cc: Tom de Vries <Tom_deVries@mentor.com>,
	    GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH][PR65802] Mark ifn_va_arg with ECF_NOTHROW
Date: Tue, 21 Apr 2015 07:50:00 -0000	[thread overview]
Message-ID: <alpine.LSU.2.11.1504210949350.20496@zhemvz.fhfr.qr> (raw)
In-Reply-To: <20150421074853.GA9659@atrey.karlin.mff.cuni.cz>

On Tue, 21 Apr 2015, Jan Hubicka wrote:

> > Mark ifn_va_arg with ECF_NOTHROW
> 
> You can defnitly make it ECF_LEAF too. I wonder if we can make it ECF_CONST or at leat PURE
> this would help to keep variadic functions const/pure that may be moderately interesting
> in practice.

Yes to ECF_LEAF but it isn't const or pure as it modifies the valist 
argument so you can't for example DCE va_arg (...) if the result isn't
needed.

Richard.

> Honza
> > 
> > 2015-04-20  Tom de Vries  <tom@codesourcery.com>
> > 
> > 	PR tree-optimization/65802
> > 	* internal-fn.def (VA_ARG): Add ECF_NOTROW to flags.
> > 
> > 	* g++.dg/pr65802.C: New test.
> > ---
> >  gcc/internal-fn.def            |  2 +-
> >  gcc/testsuite/g++.dg/pr65802.C | 29 +++++++++++++++++++++++++++++
> >  2 files changed, 30 insertions(+), 1 deletion(-)
> >  create mode 100644 gcc/testsuite/g++.dg/pr65802.C
> > 
> > diff --git a/gcc/internal-fn.def b/gcc/internal-fn.def
> > index f557c64..7e19313 100644
> > --- a/gcc/internal-fn.def
> > +++ b/gcc/internal-fn.def
> > @@ -62,4 +62,4 @@ DEF_INTERNAL_FN (ADD_OVERFLOW, ECF_CONST | ECF_LEAF | ECF_NOTHROW, NULL)
> >  DEF_INTERNAL_FN (SUB_OVERFLOW, ECF_CONST | ECF_LEAF | ECF_NOTHROW, NULL)
> >  DEF_INTERNAL_FN (MUL_OVERFLOW, ECF_CONST | ECF_LEAF | ECF_NOTHROW, NULL)
> >  DEF_INTERNAL_FN (TSAN_FUNC_EXIT, ECF_NOVOPS | ECF_LEAF | ECF_NOTHROW, NULL)
> > -DEF_INTERNAL_FN (VA_ARG, 0, NULL)
> > +DEF_INTERNAL_FN (VA_ARG, ECF_NOTHROW, NULL)
> > diff --git a/gcc/testsuite/g++.dg/pr65802.C b/gcc/testsuite/g++.dg/pr65802.C
> > new file mode 100644
> > index 0000000..26e5317
> > --- /dev/null
> > +++ b/gcc/testsuite/g++.dg/pr65802.C
> > @@ -0,0 +1,29 @@
> > +// { dg-do compile }
> > +// { dg-options "-O0" }
> > +
> > +typedef int tf ();
> > +
> > +struct S
> > +{
> > +  tf m_fn1;
> > +} a;
> > +
> > +void
> > +fn1 ()
> > +{
> > +  try
> > +    {
> > +      __builtin_va_list c;
> > +      {
> > +	int *d = __builtin_va_arg (c, int *);
> > +	int **e = &d;
> > +	__asm__("" : "=d"(e));
> > +	a.m_fn1 ();
> > +      }
> > +      a.m_fn1 ();
> > +    }
> > +  catch (...)
> > +    {
> > +
> > +    }
> > +}
> > -- 
> > 1.9.1
> > 
> 
> 

-- 
Richard Biener <rguenther@suse.de>
SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Jennifer Guild,
Dilip Upmanyu, Graham Norton HRB 21284 (AG Nuernberg)

  reply	other threads:[~2015-04-21  7:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-21  7:10 Tom de Vries
2015-04-21  7:28 ` Richard Biener
2015-04-21  7:48 ` Jan Hubicka
2015-04-21  7:50   ` Richard Biener [this message]
2015-04-26  7:18     ` Tom de Vries
2015-04-24  3:25 ` Bin.Cheng
2015-04-24 14:27   ` Tom de Vries

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LSU.2.11.1504210949350.20496@zhemvz.fhfr.qr \
    --to=rguenther@suse.de \
    --cc=Tom_deVries@mentor.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hubicka@ucw.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).