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]

PATCH: remove const/pure attribute from builtin gamma/lgamma


While looking more closely at the gamma/lgamma builtins, I realized that
we had function attribute const or pure set on them (depending on -f*
flags) but the documentation says that these functions write into an
extern global variable "signgam".  Therefore they shouldn't have these
attributes set.  So I changed them to use ATTR_MATHFN_FPROUNDING_STORE.
I had to update two testcases in the process that tested for or relied on
them having these attributes set.

Bootstrapped on sparc-sun-solaris2.10, no regressions.

I forget when they were introduced, but this bug is a regression from
before when we had attributes on these builtins.

So okay for all active branches?

		Thanks,
		--Kaveh


2006-10-30  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* builtins.def (gamma, lgamma): Use ATTR_MATHFN_FPROUNDING_STORE.

testsuite:
	* gcc.dg/torture/builtin-attr-1.c: Don't test gamma/lgamma.
	* gcc.dg/torture/builtin-convert-1.c: Don't test lgamma.

diff -rup orig/egcc-SVN20061029/gcc/builtins.def egcc-SVN20061029/gcc/builtins.def
--- orig/egcc-SVN20061029/gcc/builtins.def	2006-10-09 20:01:54.000000000 -0400
+++ egcc-SVN20061029/gcc/builtins.def	2006-10-31 09:09:03.362248955 -0500
@@ -255,9 +255,9 @@ DEF_C99_C90RES_BUILTIN (BUILT_IN_FMODL,
 DEF_LIB_BUILTIN        (BUILT_IN_FREXP, "frexp", BT_FN_DOUBLE_DOUBLE_INTPTR, ATTR_MATHFN_FPROUNDING_STORE)
 DEF_C99_C90RES_BUILTIN (BUILT_IN_FREXPF, "frexpf", BT_FN_FLOAT_FLOAT_INTPTR, ATTR_MATHFN_FPROUNDING_STORE)
 DEF_C99_C90RES_BUILTIN (BUILT_IN_FREXPL, "frexpl", BT_FN_LONGDOUBLE_LONGDOUBLE_INTPTR, ATTR_MATHFN_FPROUNDING_STORE)
-DEF_EXT_LIB_BUILTIN    (BUILT_IN_GAMMA, "gamma", BT_FN_DOUBLE_DOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
-DEF_EXT_LIB_BUILTIN    (BUILT_IN_GAMMAF, "gammaf", BT_FN_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING_ERRNO)
-DEF_EXT_LIB_BUILTIN    (BUILT_IN_GAMMAL, "gammal", BT_FN_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
+DEF_EXT_LIB_BUILTIN    (BUILT_IN_GAMMA, "gamma", BT_FN_DOUBLE_DOUBLE, ATTR_MATHFN_FPROUNDING_STORE)
+DEF_EXT_LIB_BUILTIN    (BUILT_IN_GAMMAF, "gammaf", BT_FN_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING_STORE)
+DEF_EXT_LIB_BUILTIN    (BUILT_IN_GAMMAL, "gammal", BT_FN_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_STORE)
 DEF_GCC_BUILTIN        (BUILT_IN_HUGE_VAL, "huge_val", BT_FN_DOUBLE, ATTR_CONST_NOTHROW_LIST)
 DEF_GCC_BUILTIN        (BUILT_IN_HUGE_VALF, "huge_valf", BT_FN_FLOAT, ATTR_CONST_NOTHROW_LIST)
 DEF_GCC_BUILTIN        (BUILT_IN_HUGE_VALL, "huge_vall", BT_FN_LONGDOUBLE, ATTR_CONST_NOTHROW_LIST)
@@ -291,9 +291,9 @@ DEF_C99_C90RES_BUILTIN (BUILT_IN_LDEXPL,
 DEF_GCC_BUILTIN        (BUILT_IN_LFLOOR, "lfloor", BT_FN_LONG_DOUBLE, ATTR_MATHFN_FPROUNDING)
 DEF_GCC_BUILTIN        (BUILT_IN_LFLOORF, "lfloorf", BT_FN_LONG_FLOAT, ATTR_MATHFN_FPROUNDING)
 DEF_GCC_BUILTIN        (BUILT_IN_LFLOORL, "lfloorl", BT_FN_LONG_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
-DEF_C99_BUILTIN        (BUILT_IN_LGAMMA, "lgamma", BT_FN_DOUBLE_DOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
-DEF_C99_BUILTIN        (BUILT_IN_LGAMMAF, "lgammaf", BT_FN_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING_ERRNO)
-DEF_C99_BUILTIN        (BUILT_IN_LGAMMAL, "lgammal", BT_FN_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
+DEF_C99_BUILTIN        (BUILT_IN_LGAMMA, "lgamma", BT_FN_DOUBLE_DOUBLE, ATTR_MATHFN_FPROUNDING_STORE)
+DEF_C99_BUILTIN        (BUILT_IN_LGAMMAF, "lgammaf", BT_FN_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING_STORE)
+DEF_C99_BUILTIN        (BUILT_IN_LGAMMAL, "lgammal", BT_FN_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_STORE)
 DEF_GCC_BUILTIN        (BUILT_IN_LLCEIL, "llceil", BT_FN_LONGLONG_DOUBLE, ATTR_MATHFN_FPROUNDING)
 DEF_GCC_BUILTIN        (BUILT_IN_LLCEILF, "llceilf", BT_FN_LONGLONG_FLOAT, ATTR_MATHFN_FPROUNDING)
 DEF_GCC_BUILTIN        (BUILT_IN_LLCEILL, "llceill", BT_FN_LONGLONG_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
diff -rup orig/egcc-SVN20061029/gcc/testsuite/gcc.dg/torture/builtin-attr-1.c egcc-SVN20061029/gcc/testsuite/gcc.dg/torture/builtin-attr-1.c
--- orig/egcc-SVN20061029/gcc/testsuite/gcc.dg/torture/builtin-attr-1.c	2006-01-22 23:31:00.000000000 -0500
+++ egcc-SVN20061029/gcc/testsuite/gcc.dg/torture/builtin-attr-1.c	2006-10-31 09:09:08.478827453 -0500
@@ -336,7 +336,6 @@ FPTEST3            (fma)
 FPTEST2            (fmax)
 FPTEST2            (fmin)
 FPTEST2            (fmod)
-FPTEST1            (gamma)
 BUILTIN_FPTEST0    (huge_val)
 FPTEST2            (hypot)
 FPTEST1T           (ilogb, int)
@@ -345,7 +344,6 @@ FPTEST1            (j0)
 FPTEST1            (j1)
 FPTEST2ARG1        (jn, int)
 FPTEST2ARG2        (ldexp, int)
-FPTEST1            (lgamma)
 FPTEST1T           (llrint, long long)
 FPTEST1T           (llround, long long)
 FPTEST1            (log)
diff -rup orig/egcc-SVN20061029/gcc/testsuite/gcc.dg/torture/builtin-convert-1.c egcc-SVN20061029/gcc/testsuite/gcc.dg/torture/builtin-convert-1.c
--- orig/egcc-SVN20061029/gcc/testsuite/gcc.dg/torture/builtin-convert-1.c	2006-10-08 01:32:11.000000000 -0400
+++ egcc-SVN20061029/gcc/testsuite/gcc.dg/torture/builtin-convert-1.c	2006-10-31 09:09:08.479879389 -0500
@@ -106,7 +106,6 @@ void test(double d1, float f1, long doub
   OUTER_CAST1 (exp2, /*C99=*/ 1);
   OUTER_CAST1 (expm1, /*C99=*/ 1);
   OUTER_CAST1 (fabs, /*C99=*/ 0);
-  OUTER_CAST1 (lgamma, /*C99=*/ 1);
   OUTER_CAST1 (log, /*C99=*/ 0);
   OUTER_CAST1 (log10, /*C99=*/ 0);
   OUTER_CAST1 (log1p, /*C99=*/ 1);


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