[Ecls-list] [PATCH] Improve floating-point exception handling.

Alexander Gavrilov angavrilov at gmail.com
Tue Jun 2 09:00:17 UTC 2009


On Tue, Jun 2, 2009 at 12:32 PM, Juan Jose Garcia-Ripoll
<juanjose.garciaripoll at googlemail.com> wrote:
> On Tue, Jun 2, 2009 at 10:27 AM, Alexander Gavrilov
> <angavrilov at gmail.com> wrote:
>> By the way, that 'static int last_bits' in si_trap_fpe is not very
>> thread-safe. This value probably should be in the environment
>> structure, because exception configuration is independent for
>> different threads.
>
> Are you sure of this? The ISO C99 manual pages and the Linux manual
> pages do not say anything about threads.

Exception configuration is done on Intel CPUs by changing the values
of two special CPU registers (see fldcw and ldmxcsr). All register
state is per-thread.

It was also confirmed by practical experience: I had to run
(si:trap-fpe 'floating-point-underflow nil) in all threads.

Alexander




More information about the ecl-devel mailing list