> Stephan Frank wrote:
>> I think items 1-4 are taken care of now (though I'll run some further
>> tests). However, I'm still unsure about item 5. Resolving an absent
>> libgmp.so gracefully will mostly reimplement functionality of
>> SB-ALIEN::TRY-REOPEN-SHARED-OBJECT by disabling an automatic reload
>> during saved core startup.
>
> Some questions that popped up while I made some changes to SB-GMP
> (nothing blocking for a commit from my POV, simply things to think about
> for later):
>
> 1. In two places, you wrote "positive"; is that strictly positive, or
> non-negative? Clearly, GMP-Z-TO-BIGNUM is the latter, but I'm not sure
> for RAND-SEED.
>
> 2. What happens if we mistakenly allocate too little space for the
> result? I seem to observe silent "success."
Previous answer was wrong; I remembered I related case: the second part
from the previous answer is correct; realloc is acalled with a pointer
into the SBCL heap for the bignum buffer, this barfs and lands in ldb.
> 3. How does GMP handle error? Does it still just printf to stderr and
> abort? (I see that it seems to signal a division by zero correctly, at
> least)
>
> 4. mpz_mod ignores the divisor's sign. AFAICT, it's the only functions
> that does so; is that right?
>
> Paul Khuong
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Windows:
>
> Build for Windows Store.
>
> http://p.sf.net/sfu/windows-dev2dev
> _______________________________________________
> Sbcl-devel mailing list
> Sbcl-devel@...
> https://lists.sourceforge.net/lists/listinfo/sbcl-devel
>

> Stephan Frank wrote:
>> I think items 1-4 are taken care of now (though I'll run some further
>> tests). However, I'm still unsure about item 5. Resolving an absent
>> libgmp.so gracefully will mostly reimplement functionality of
>> SB-ALIEN::TRY-REOPEN-SHARED-OBJECT by disabling an automatic reload
>> during saved core startup.
>
> Some questions that popped up while I made some changes to SB-GMP
> (nothing blocking for a commit from my POV, simply things to think about
> for later):
>
> 1. In two places, you wrote "positive"; is that strictly positive, or
> non-negative? Clearly, GMP-Z-TO-BIGNUM is the latter, but I'm not sure
> for RAND-SEED.
>= 0 is allowed (though 0 wouldn't really make sense)
> 2. What happens if we mistakenly allocate too little space for the
> result? I seem to observe silent "success."
You either get the wrong result (in very rare cases) or mostly land in ldb
where you likely (at least on Ubutnu) see the backtrace to the GMP
allocation function. Currently, all function were the max. required space
can be predetermined use SBCL-side allocation (this popped up frequently
in the beginning when I simply copied the buffer sized from Waldek; since
then I have looked at the GMP sources and have adjusted the SB-GMP buffer
allocation sizes), the others copy from a GMP allocated bignum (though
this is about factor 3 slower).
> 3. How does GMP handle error? Does it still just printf to stderr and
> abort? (I see that it seems to signal a division by zero correctly, at
> least)
Frankly, that is also one of the mysteries I have on my TODO to explore. I
checked for div-by-zero as well :-) and decided to check parameters on the
Lisp side to avoid things such as negative SQRT etc.
> 4. mpz_mod ignores the divisor's sign. AFAICT, it's the only functions
> that does so; is that right?
As far as I remember, this was the only function that I interfaced which
does this (according to the GMP manual).
Thanks for your bug fixing work, though I am quite puzzled why the bugs
didn't pop up with the three systems I tested on. I can only merge your
pull request tonight since there appear to be some conflicts and the web
interface can't handle this, so I need my development machine.
Regs,
Stephan
------------------------------------------------------------------------------
> This SF.net email is sponsored by Windows:
>
> Build for Windows Store.
>
> http://p.sf.net/sfu/windows-dev2dev
> _______________________________________________
> Sbcl-devel mailing list
> Sbcl-devel@...
> https://lists.sourceforge.net/lists/listinfo/sbcl-devel
>

Stephan Frank wrote:
> I think items 1-4 are taken care of now (though I'll run some further
> tests). However, I'm still unsure about item 5. Resolving an absent
> libgmp.so gracefully will mostly reimplement functionality of
> SB-ALIEN::TRY-REOPEN-SHARED-OBJECT by disabling an automatic reload
> during saved core startup.
Some questions that popped up while I made some changes to SB-GMP
(nothing blocking for a commit from my POV, simply things to think about
for later):
1. In two places, you wrote "positive"; is that strictly positive, or
non-negative? Clearly, GMP-Z-TO-BIGNUM is the latter, but I'm not sure
for RAND-SEED.
2. What happens if we mistakenly allocate too little space for the
result? I seem to observe silent "success."
3. How does GMP handle error? Does it still just printf to stderr and
abort? (I see that it seems to signal a division by zero correctly, at
least)
4. mpz_mod ignores the divisor's sign. AFAICT, it's the only functions
that does so; is that right?
Paul Khuong

James M. Lawrence wrote:
> I didn't see a change after upgrading to gmp-5.1.2. pkhuong's branch
> worked with the old and new gmp (his sb-gmp-test.asd needs updating:
> "test" -> "tests", remove fiveam, add sb-rt).
Good! (and I forgot to remove that file)
Paul Khuong