summaryrefslogtreecommitdiff
path: root/tests/tget_flt.c
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2013-09-26 13:21:02 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2013-09-26 13:21:02 +0000
commita2fa7f1d0db7b620266206125680c4ec0ee2513d (patch)
tree7aef46e93fd63e2d1e689232b9981a9ceb252d98 /tests/tget_flt.c
parente7456c2d7bfe2bd912b4a136bf77b9e457bc082f (diff)
downloadmpfr-a2fa7f1d0db7b620266206125680c4ec0ee2513d.tar.gz
[tests/tget_flt.c] Protect a division by 0.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@8685 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tget_flt.c')
-rw-r--r--tests/tget_flt.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/tget_flt.c b/tests/tget_flt.c
index 6fa29f663..74a581ab6 100644
--- a/tests/tget_flt.c
+++ b/tests/tget_flt.c
@@ -31,6 +31,11 @@ main (void)
float f, g, infp;
int i;
+ tests_start_mpfr ();
+
+#if !defined(MPFR_ERRDIVZERO)
+ /* The definition of DBL_POS_INF involves a division by 0. This makes
+ "clang -O2 -fsanitize=undefined -fno-sanitize-recover" fail. */
infp = (float) DBL_POS_INF;
if (infp * 0.5 != infp)
{
@@ -38,8 +43,7 @@ main (void)
fprintf (stderr, "(this is probably a compiler bug, please report)\n");
exit (1);
}
-
- tests_start_mpfr ();
+#endif
mpfr_init2 (x, 24);
mpfr_init2 (y, 24);