I've figured out why Pike dumps core when using very large numbers in GMP. See this link for more info:
Are there any good reasons why we should not always compile GMP with --enable-alloca=malloc-reentrant, now that we know both the cause of and solution to the problem?
/ Johan Sundström (fångar heffaklumpar)
Previous text:
2003-11-20 02:49: Subject: Strange GMP coredumps
I've figured out why Pike dumps core when using very large numbers in GMP. See this link for more info:
http://fredrik.hubbe.net/hacker/viewtopic.php?t=26
/ Fredrik (Naranek) Hubinette (Real Build Master)
I don't know of a reason not to use --enable-alloca=malloc-reentrant yet. (I just did this myself.) I guess we should really try to alert the GMP authors, debian maintainers etc. to this isse and try to get them to use malloc-reentrant by default instead of just "reentrant".
/ Fredrik (Naranek) Hubinette (Real Build Master)
Previous text:
2003-11-20 02:53: Subject: Strange GMP coredumps
Are there any good reasons why we should not always compile GMP with --enable-alloca=malloc-reentrant, now that we know both the cause of and solution to the problem?
/ Johan Sundström (fångar heffaklumpar)
The code will run a little slower, in particular for smaller numbers.
Which version of gmp are you using, and which function(s) were responsible for that large stack allocation? I don't think GMP is supposed to allocate large numbers on the stack. Try sending a bug report to gmp-bugs@swox.com.
/ Niels Möller (igelkottsräddare)
Previous text:
2003-11-20 02:57: Subject: Strange GMP coredumps
I don't know of a reason not to use --enable-alloca=malloc-reentrant yet. (I just did this myself.) I guess we should really try to alert the GMP authors, debian maintainers etc. to this isse and try to get them to use malloc-reentrant by default instead of just "reentrant".
/ Fredrik (Naranek) Hubinette (Real Build Master)
The version is 4.1.2, and the function is mpn_tdiv_qr(), which is the main division function. There are probably other functions that do the same thing.
/ Fredrik (Naranek) Hubinette (Real Build Master)
Previous text:
2003-11-20 09:43: Subject: Strange GMP coredumps
The code will run a little slower, in particular for smaller numbers.
Which version of gmp are you using, and which function(s) were responsible for that large stack allocation? I don't think GMP is supposed to allocate large numbers on the stack. Try sending a bug report to gmp-bugs@swox.com.
/ Niels Möller (igelkottsräddare)
Looking into the current cvs source, it seems mpn_tdiv_qr still allocates linear amount of storage on the stack.
I'll ask on the gmp-devel list what can be done about it.
For the next gmp release, whenever that happens, I think the plan is that no mpn functions should allocate temporary storage by themselves, instead the caller will have to provide scratch space in an additional argument.
/ Niels Möller (igelkottsräddare)
Previous text:
2003-11-20 20:22: Subject: Strange GMP coredumps
The version is 4.1.2, and the function is mpn_tdiv_qr(), which is the main division function. There are probably other functions that do the same thing.
/ Fredrik (Naranek) Hubinette (Real Build Master)
pike-devel@lists.lysator.liu.se