diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2011-05-03 07:34:04 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2011-05-03 07:34:04 +0000 |
commit | 59cb6c3245a95b554d5ff1c083b32b464e80a659 (patch) | |
tree | 0ccc54870338cf8702a68d0a0966470ce41603b3 /src/rec_sqrt.c | |
parent | be99863f7757864375b34deb2418f5977e2dd688 (diff) | |
download | mpfr-59cb6c3245a95b554d5ff1c083b32b464e80a659.tar.gz |
[src/rec_sqrt.c] Improved the comment added in r7651.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@7652 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'src/rec_sqrt.c')
-rw-r--r-- | src/rec_sqrt.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/rec_sqrt.c b/src/rec_sqrt.c index 7e4d3ac3d..7894a08b5 100644 --- a/src/rec_sqrt.c +++ b/src/rec_sqrt.c @@ -375,14 +375,15 @@ mpfr_mpn_rec_sqrt (mpfr_limb_ptr x, mpfr_prec_t p, MPFR_ASSERTD(un == ln + 1 || un == ln + 2); /* the high un-ln limbs of u will overlap the low part of {x+ln,xn}, we need to add or subtract the overlapping part {u + ln, un - ln} */ - /* Warning! th may be 0, in which case mpn_add_1 and mpn_sub_1 - mustn't be used. In such a case, the limb (carry) will be 0, - so that this is semantically a no-op, but if mpn_add_1 and - mpn_sub_1 are used, GMP still does a non-atomic read/write - in a place that is not always allocated, with the possible - consequences: a crash if the memory is not mapped, or (a bit - unlikely) memory corruption if another process/thread writes - at the same place. */ + /* Warning! th may be 0, in which case the mpn_add_1 and mpn_sub_1 + below (with size = th) mustn't be used. In such a case, the limb + (carry) will be 0, so that this is semantically a no-op, but if + mpn_add_1 and mpn_sub_1 are used, GMP (currently) still does a + non-atomic read/write in a place that is not always allocated, + with the possible consequences: a crash if the corresponding + address is not mapped, or (rather unlikely) memory corruption + if another process/thread writes at the same place; things may + be worse with future GMP versions. Hence the tests carry != 0. */ if (neg == 0) { if (ln > 0) |