diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2016-02-09 01:31:17 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2016-02-09 01:31:17 +0000 |
commit | e4cfa1e93279b6ac2edfc6b37989b40913c0ccd3 (patch) | |
tree | d8bd2e24ba0491f08fa463cf95e56c3a13796a7c /tests/tgeneric_ui.c | |
parent | 0d6c72a5bcc72cb45be10a9b15a05feaee97f19f (diff) | |
download | mpfr-e4cfa1e93279b6ac2edfc6b37989b40913c0ccd3.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 r9998 when
using an UB sanitizer (bug fixed in r9999).
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@10001 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tgeneric_ui.c')
-rw-r--r-- | tests/tgeneric_ui.c | 11 |
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); |