summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>2007-08-02 02:57:26 +0000
committerghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>2007-08-02 02:57:26 +0000
commitbe19d1b16e9f7dfd3b7cbec1423a7097fd5262d2 (patch)
tree110c275cde5018c78a949eba77f12c20fe2df92a /gcc
parentc635f86fa6c98bb326b0912988104fd49b78783b (diff)
downloadgcc-be19d1b16e9f7dfd3b7cbec1423a7097fd5262d2.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@127146 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/call.c2
-rw-r--r--gcc/testsuite/ChangeLog7
-rw-r--r--gcc/testsuite/g++.dg/torture/type-generic-1.C11
-rw-r--r--gcc/testsuite/gcc.dg/pr28796-2.c110
-rw-r--r--gcc/testsuite/gcc.dg/torture/type-generic-1.c11
6 files changed, 39 insertions, 107 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 8004e191493..6bbdac6ea85 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2007-08-01 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ PR middle-end/32668
+ * call.c (magic_varargs_p): Honor the "type generic" attribute.
+
2007-07-30 Paolo Carlini <pcarlini@suse.de>
PR c++/32108
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 1f220f03910..31ca3c2d7f6 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 15364b98d94..7e9392b23c6 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2007-08-01 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * 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 <tkoenig@gcc.gnu.org>
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 00000000000..89f87f3b2c7
--- /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 c69a60e0c4a..6a9eff827b7 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 00000000000..4326127cee0
--- /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 ();
+}