This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH]: Testcase for buggy MPFR versions
- From: "Kaveh R. GHAZI" <ghazi at caip dot rutgers dot edu>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sun, 17 Dec 2006 19:44:01 -0500 (EST)
- Subject: [PATCH]: Testcase for buggy MPFR versions
This testcase checks for a bug in MPFR that exists in mpfr-2.2.0. There
exist some fixes for mpfr-2.2.0 in a "cumulative patch", however this bug
and several others are not fixed by that patch. The problem is however
addressed in mpfr-2.2.1.
Since many people were against a hard requirement for mpfr-2.2.1 in gcc,
this testcase helps illustrate to the user that they may wish to upgrade
their MPFR package without stopping them from building gcc.
Note: the existing builtin-sin-mpfr-1.c test is similar but slightly
different in that the underlying sin bug it tests *is* in fact fixed by
the cumulative patch. The pow one is not.
Tested with mainline linked with mpfr-2.2.0, mpfr-2.2.0+cumulative patch
and mpfr-2.2.1. The testcase fails in the first two cases and passes in
the latter one (as expected).
Okay for mainline?
Thanks,
--Kaveh
2006-12-17 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* gcc.dg/torture/builtin-pow-mpfr-1.c: New test.
diff -rup orig/egcc-SVN20061216/gcc/testsuite/gcc.dg/torture/builtin-pow-mpfr-1.c egcc-SVN20061216/gcc/testsuite/gcc.dg/torture/builtin-pow-mpfr-1.c
--- orig/egcc-SVN20061216/gcc/testsuite/gcc.dg/torture/builtin-pow-mpfr-1.c 2006-12-17 19:25:00.560310022 -0500
+++ egcc-SVN20061216/gcc/testsuite/gcc.dg/torture/builtin-pow-mpfr-1.c 2006-12-17 19:23:47.683436338 -0500
@@ -0,0 +1,19 @@
+/* Version 2.2.0 of MPFR had bugs in pow underflow/overflow. This
+ test checks to see if that buggy version was installed. The
+ problem is NOT fixed with the version 2.2.0 "cumulative patch".
+ However it is fixed in version 2.2.1 and presumably later MPFR
+ versions.
+
+ Origin: Kaveh R. Ghazi 12/17/2006. */
+
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+extern double testit()
+{
+ /* This underflows and therefore gcc should not fold it. */
+ return __builtin_pow (0.11, 1.0e38);
+}
+
+/* { dg-final { scan-tree-dump "pow" "original" } } */
+/* { dg-final { cleanup-tree-dump "original" } } */