misleading error message
Vincent Lefevre
vincent at vinc17.net
Wed Sep 25 00:18:59 CEST 2024
On 2024-09-24 15:50:40 +0200, Sergey B Kirpichev wrote:
> On Tue, Sep 24, 2024 at 01:22:03PM +0200, Vincent Lefevre wrote:
> > So perhaps SIGFPE is the right thing for GMP after all (as this
> > could be regarded as overflow / out of range). In any case, the
> > "Floating point exception" message from the system is incorrect,
> > as SIGFPE is also generated for integer operations.
>
> But I don't see why SIGFPE here is the right thing, while printing
> an error message to stderr and calling abort() (as for errors
> in the memory.c) - is not.
>
> BTW, description in
> https://pubs.opengroup.org/onlinepubs/009695399/basedefs/signal.h.html
> lists SIGFPE as "Erroneous arithmetic operation." Perhaps, such message
> from the system might be even more misleading for memory-related errors.
Later you have for SIGFPE:
FPE_INTOVF Integer overflow.
which is exactly the case here: the value would be larger than
the maximum integer value supported by GMP (this maximum value
is implied by the bound on the size of a mpz_t).
--
Vincent Lefèvre <vincent at vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
More information about the gmp-discuss
mailing list