diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2018-09-04 17:29:15 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2018-09-04 17:29:15 +0000 |
commit | da3d99a4520b63a2e4adb8a59b60b56caeda3d7f (patch) | |
tree | fa003780c87416413d46a177e5cb8b6be234b73f /tests/tset_z_exp.c | |
parent | ed78f7fe39aa8bb40ed64855245c44304f0dddba (diff) | |
download | mpfr-da3d99a4520b63a2e4adb8a59b60b56caeda3d7f.tar.gz |
[tests/tset_z_exp.c] Avoid a GCC bug.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@13132 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tset_z_exp.c')
-rw-r--r-- | tests/tset_z_exp.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/tests/tset_z_exp.c b/tests/tset_z_exp.c index d68c8a643..6a22ae138 100644 --- a/tests/tset_z_exp.c +++ b/tests/tset_z_exp.c @@ -38,13 +38,14 @@ randexp (void) { mpfr_uexp_t emax = (mpfr_uexp_t) -1; - /* FIXME: This looks correct, but GCC complains. */ e = 0; while (emax != 0) { - /* Since mp_limb_t < mpfr_uexp_t, the shift counts are valid. */ - e = (e << GMP_NUMB_BITS) + randlimb (); - emax >>= GMP_NUMB_BITS; + /* Since mp_limb_t < mpfr_uexp_t, the shift counts are valid. + Use GMP_NUMB_BITS - 1 instead of GMP_NUMB_BITS to avoid a + bug in GCC. */ + e = (e << (GMP_NUMB_BITS - 1)) + (randlimb () >> 1); + emax >>= GMP_NUMB_BITS - 1; } } return (mpfr_exp_t) (e % (__gmpfr_emax - __gmpfr_emin)) + __gmpfr_emin; |