This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: Need details about generating traps for floating point exceptions
- From: Adhemerval Zanella <adhemerval dot zanella at linaro dot org>
- To: libc-help at sourceware dot org
- Date: Wed, 4 Sep 2019 16:53:14 -0300
- Subject: Re: Need details about generating traps for floating point exceptions
- References: <CAEe-xqQWP=HSLMLttwLP1g9RXB1QxToBAy07MwDWe14-XNaD9A@mail.gmail.com>
On 24/06/2019 08:40, Faisal Riyaz wrote:
> Hi,
>
>
> I am interested in knowing more about how traps are generated when floating
> point exception occur.
>
> Currently, gcc for RISC-V(riscv64-unknown-elf-gcc (GCC) 8.2.0) does not
> generate traps on encountering
>
> floating point exceptions.
>
>
> I am going through glibc source code. I found .c files for functions
> defined in fenv.h to handle floating point
>
> exceptions but i am not able to figure out how trap is generated.
>
> Thanks
>
> Faisal
Just for the record, as explained in the stackoverflow thread [1], glibc
itself does not *generate* the exceptions itself, although it can *raise*
them if is the case (accordingly to ISA if allows it).
Although it is expected that every port to implement all the functions
defined at fenv.h, each architecture might have different floating-point
semantic and might not fully cover the floating-point standards.
On internal testing we have some macros each port can override to
enable/disable trap testing (check the sysdeps/generic/math-tests-trap.h).
On RISC-V, specifically, it states:
sysdeps/riscv/math-tests-trap.h
23 /* Trapping exceptions are not supported on RISC-V. */
24 #define EXCEPTION_ENABLE_SUPPORTED(EXCEPT) ((EXCEPT) == 0)
[1] https://stackoverflow.com/questions/56746968/how-are-traps-generated-for-floating-point-exceptions