misleading error message
Sergey B Kirpichev
skir at sagemath.org
Wed Sep 25 06:53:14 CEST 2024
On Tue, Sep 24, 2024 at 08:13:12PM +0200, marco.bodrato at tutanota.com wrote:
> I have no particular opinion about "is it better to print a message and abort() or rising SIGFPE?".
I doubt error message like "Floating point exception" from system helps people
to identify concrete problem with GMP. Especially, as it happens also in other
conditions (e.g. sqrt of negative integer).
> But I think that it should be better to have a single function (eg. __gmp_exception in errno.c) called by every part of code that have to handle a critical error.
> That way, those that disagree with the answer to the question above have a single file and a single function to change to adapt the library to their needs.
Well, in gmpy2 we ended with a signal handler that catch SIGFPE, prints some
specific error message and calls abort(). Patching system-wide installed
libraries is not an option sometimes...
> Actually, the error you refer to is not "memory-related"; it's an overflow of the mpz_t type.
Indeed, that's more correct.
Yet I don't see why there couldn't be a single function to handle critical errors,
that also prints custom error messages before calling abort() or raise(SIGFPE).
More information about the gmp-discuss
mailing list