From 59f89d34775aaf2a88881273713e485abb560bee Mon Sep 17 00:00:00 2001 From: "Kaveh R. Ghazi" Date: Thu, 2 Aug 2007 02:57:26 +0000 Subject: re PR middle-end/32668 (The type-generic builtins apply default promotions) gcc/cp: PR middle-end/32668 * call.c (magic_varargs_p): Honor the "type generic" attribute. gcc/testsuite: * g++.dg/torture/type-generic-1.C: New. * gcc.dg/pr28796-2.c: Move tests ... * gcc.dg/tg-tests.h: ... here. * gcc.dg/torture/type-generic-1.c: New. From-SVN: r127146 --- gcc/cp/ChangeLog | 5 ++ gcc/cp/call.c | 2 + gcc/testsuite/ChangeLog | 7 ++ gcc/testsuite/g++.dg/torture/type-generic-1.C | 11 +++ gcc/testsuite/gcc.dg/pr28796-2.c | 110 +------------------------- gcc/testsuite/gcc.dg/torture/type-generic-1.c | 11 +++ 6 files changed, 39 insertions(+), 107 deletions(-) create mode 100644 gcc/testsuite/g++.dg/torture/type-generic-1.C create mode 100644 gcc/testsuite/gcc.dg/torture/type-generic-1.c diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 8004e19..6bbdac6 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2007-08-01 Kaveh R. Ghazi + + PR middle-end/32668 + * call.c (magic_varargs_p): Honor the "type generic" attribute. + 2007-07-30 Paolo Carlini PR c++/32108 diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 1f220f0..31ca3c2 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -4816,6 +4816,8 @@ magic_varargs_p (tree fn) return true; default:; + return lookup_attribute ("type generic", + TYPE_ATTRIBUTES (TREE_TYPE (fn))) != 0; } return false; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 15364b9..7e9392b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2007-08-01 Kaveh R. Ghazi + + * g++.dg/torture/type-generic-1.C: New. + * gcc.dg/pr28796-2.c: Move tests ... + * gcc.dg/tg-tests.h: ... here. + * gcc.dg/torture/type-generic-1.c: New. + 2007-08-01 Thomas Koenig PR libfortran/32954 diff --git a/gcc/testsuite/g++.dg/torture/type-generic-1.C b/gcc/testsuite/g++.dg/torture/type-generic-1.C new file mode 100644 index 0000000..89f87f3 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/type-generic-1.C @@ -0,0 +1,11 @@ +/* Do the type-generic tests. Unlike pr28796-2.c, we test these + without any fast-math flags. */ + +/* { dg-do run } */ + +#include "../../gcc.dg/tg-tests.h" + +int main(void) +{ + return main_tests (); +} diff --git a/gcc/testsuite/gcc.dg/pr28796-2.c b/gcc/testsuite/gcc.dg/pr28796-2.c index c69a60e..6a9eff8 100644 --- a/gcc/testsuite/gcc.dg/pr28796-2.c +++ b/gcc/testsuite/gcc.dg/pr28796-2.c @@ -2,113 +2,9 @@ /* { dg-options "-O2 -funsafe-math-optimizations -fno-finite-math-only" } */ /* { dg-options "-mieee -O2 -funsafe-math-optimizations -fno-finite-math-only" { target alpha*-*-* } } */ -extern void abort (void); +#include "tg-tests.h" -void __attribute__ ((__noinline__)) -foo_1 (float f, double d, long double ld, - int res_unord, int res_isnan, int res_isinf, - int res_isfin, int res_isnorm) +int main(void) { - if (__builtin_isunordered (f, 0) != res_unord) - abort (); - if (__builtin_isunordered (0, f) != res_unord) - abort (); - if (__builtin_isunordered (d, 0) != res_unord) - abort (); - if (__builtin_isunordered (0, d) != res_unord) - abort (); - if (__builtin_isunordered (ld, 0) != res_unord) - abort (); - if (__builtin_isunordered (0, ld) != res_unord) - abort (); - - if (__builtin_isnan (f) != res_isnan) - abort (); - if (__builtin_isnan (d) != res_isnan) - abort (); - if (__builtin_isnan (ld) != res_isnan) - abort (); - if (__builtin_isnanf (f) != res_isnan) - abort (); - if (__builtin_isnanl (ld) != res_isnan) - abort (); - - if (__builtin_isinf (f) != res_isinf) - abort (); - if (__builtin_isinf (d) != res_isinf) - abort (); - if (__builtin_isinf (ld) != res_isinf) - abort (); - if (__builtin_isinff (f) != res_isinf) - abort (); - if (__builtin_isinfl (ld) != res_isinf) - abort (); - - if (__builtin_isnormal (f) != res_isnorm) - abort (); - if (__builtin_isnormal (d) != res_isnorm) - abort (); - if (__builtin_isnormal (ld) != res_isnorm) - abort (); - - if (__builtin_isfinite (f) != res_isfin) - abort (); - if (__builtin_isfinite (d) != res_isfin) - abort (); - if (__builtin_isfinite (ld) != res_isfin) - abort (); - - if (__builtin_finitef (f) != res_isfin) - abort (); - if (__builtin_finite (f) != res_isfin) - abort (); - if (__builtin_finite (d) != res_isfin) - abort (); - if (__builtin_finitel (d) != res_isfin) - abort (); - if (__builtin_finitel (ld) != res_isfin) - abort (); -} - -void __attribute__ ((__noinline__)) -foo (float f, double d, long double ld, - int res_unord, int res_isnan, int res_isinf, - int res_isfin, int res_isnorm) -{ - foo_1 (f, d, ld, res_unord, res_isnan, res_isinf, res_isfin, res_isnorm); - /* Try all values negative as well. */ - foo_1 (-f, -d, -ld, res_unord, res_isnan, res_isinf, res_isfin, res_isnorm); -} - -int main() -{ - float f; - double d; - long double ld; - - f = __builtin_nanf(""); d = __builtin_nan(""); ld = __builtin_nanl(""); - foo(f, d, ld, /*unord=*/ 1, /*isnan=*/ 1, /*isinf=*/ 0, /*isfin=*/ 0, /*isnorm=*/ 0); - - f = __builtin_inff(); d = __builtin_inf(); ld = __builtin_infl(); - foo(f, d, ld, /*unord=*/ 0, /*isnan=*/ 0, /*isinf=*/ 1, /*isfin=*/ 0, /*isnorm=*/ 0); - - f = 0; d = 0; ld = 0; - foo(f, d, ld, /*unord=*/ 0, /*isnan=*/ 0, /*isinf=*/ 0, /*isfin=*/ 1, /*isnorm=*/ 0); - - f = 1; d = 1; ld = 1; - foo(f, d, ld, /*unord=*/ 0, /*isnan=*/ 0, /*isinf=*/ 0, /*isfin=*/ 1, /*isnorm=*/ 1); - - f = __FLT_MIN__; d = __DBL_MIN__; ld = __LDBL_MIN__; - foo(f, d, ld, /*unord=*/ 0, /*isnan=*/ 0, /*isinf=*/ 0, /*isfin=*/ 1, /*isnorm=*/ 1); - - f = __FLT_MIN__/2; d = __DBL_MIN__/2; ld = __LDBL_MIN__/2; - foo(f, d, ld, /*unord=*/ 0, /*isnan=*/ 0, /*isinf=*/ 0, /*isfin=*/ 1, /*isnorm=*/ 0); - - f = __FLT_MAX__; d = __DBL_MAX__; ld = __LDBL_MAX__; - foo(f, d, ld, /*unord=*/ 0, /*isnan=*/ 0, /*isinf=*/ 0, /*isfin=*/ 1, /*isnorm=*/ 1); - - f = __FLT_MAX__*2; d = __DBL_MAX__*2; ld = __LDBL_MAX__*2; - foo(f, d, ld, /*unord=*/ 0, /*isnan=*/ 0, /*isinf=*/ 1, /*isfin=*/ 0, /*isnorm=*/ 0); - - return 0; + return main_tests (); } diff --git a/gcc/testsuite/gcc.dg/torture/type-generic-1.c b/gcc/testsuite/gcc.dg/torture/type-generic-1.c new file mode 100644 index 0000000..4326127 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/type-generic-1.c @@ -0,0 +1,11 @@ +/* Do the type-generic tests. Unlike pr28796-2.c, we test these + without any fast-math flags. */ + +/* { dg-do run } */ + +#include "../tg-tests.h" + +int main(void) +{ + return main_tests (); +} -- cgit v1.1