[PATCH 3/3] x86: Do not raises floating-point exception traps on fesetexceptflag (BZ 30990)

Adhemerval Zanella Netto adhemerval.zanella@linaro.org
Tue Oct 24 11:13:18 GMT 2023



On 23/10/23 21:19, Bruno Haible wrote:
> Adhemerval Zanella wrote:
>> diff --git a/math/test-fexcept-traps.c b/math/test-fexcept-traps.c
>> index 9b8f583ae6..a486d17951 100644
>> --- a/math/test-fexcept-traps.c
>> +++ b/math/test-fexcept-traps.c
>> @@ -67,6 +68,16 @@ do_test (void)
>>       where setting the exception might result in traps the function should
>>       return a nonzero value.  */
>>    ret = fesetexceptflag (&saved, FE_ALL_EXCEPT);
>> +
>> +  /* Execute some floating-point operations, since on some CPUs exceptions
>> +     triggers a trap only at the next floating-point instruction.  */
>> +  double a = 1.0;
>> +  double b = a + a;
>> +  math_force_eval (b);
>> +  long double al = 1.0L;
>> +  long double bl = al + al;
> 
> Like in [2/3], I would mark the variables a, b, al, bl as 'volatile',
> otherwise it's too easy for GCC to do constant-folding and thus eliminate
> the floating-point operations.

Ack.


More information about the Libc-alpha mailing list