[Aldor-l] Bigint bug(!)

Ralf Hemmecke ralf at hemmecke.de
Fri Aug 15 19:39:03 EDT 2008


 > bigint has a definite bug on twos complement systems. In xintStoreI,
 > which takes a signed long, the following code fails for LONG_MIN:

Could you next time give the full path to the file where the problem 
occurs? Thanks.

 >   u = (n < 0) ? -n : n;
 >
 > LONG_MIN is -2147483648 on 32 bit platforms and on twos complement
 > systems, applying unary - to that will set the OF bit of the CFLAGS
 > register to 1 (it causes a signed overflow). How should we fix this?
 > It is a no-go to cause an assertion error on this.

My suggestion: remove the bigint code completely and replace it with 
GMP. Would that be a problem? Wouldn't that save your valuable debugging 
time?

Good detective work. I wonder what a Aldor program might be that hits 
this bug.

Ralf




More information about the Aldor-l mailing list