summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2016-02-09 01:34:37 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2016-02-09 01:34:37 +0000
commitbc8bf16b79cefde77986c582fb664e1486fd4509 (patch)
tree281a70664bd9e8677c57131084c6767813700725 /tests
parent253f9742e1ef8d625592e71751048c31046c87b9 (diff)
downloadmpfr-bc8bf16b79cefde77986c582fb664e1486fd4509.tar.gz
[tests/tgeneric_ui.c] Added tests of the extreme integer values,
so that tsi_op fails with a runtime error in si_op.c when using an UB sanitizer (bug fixed in r9999 in the trunk). (merged changeset r10001 from the trunk) git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/3.1@10002 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests')
-rw-r--r--tests/tgeneric_ui.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/tgeneric_ui.c b/tests/tgeneric_ui.c
index 8604ee684..94658787d 100644
--- a/tests/tgeneric_ui.c
+++ b/tests/tgeneric_ui.c
@@ -64,7 +64,16 @@ test_generic_ui (mpfr_prec_t p0, mpfr_prec_t p1, unsigned int N)
mpfr_set_si (x, n == 0 ? 1 : -1, MPFR_RNDN);
mpfr_set_exp (x, mpfr_get_emin ());
}
- u = INT_RAND_FUNCTION ();
+ if (n < 2 || n > 3 || prec < p1)
+ u = INT_RAND_FUNCTION ();
+ else
+ {
+ /* Special cases tested in precision p1 if n = 2 or 3. */
+ if ((INTEGER_TYPE) -1 < 0) /* signed, type long assumed */
+ u = n == 2 ? LONG_MIN : LONG_MAX;
+ else /* unsigned */
+ u = n == 2 ? 0 : -1;
+ }
rnd = RND_RAND ();
mpfr_set_prec (y, yprec);
compare = TEST_FUNCTION (y, x, u, rnd);