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][PR65802] Mark ifn_va_arg with ECF_NOTHROW


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

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
> 


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