ARC math test regressions (was Re: [PATCH v7 00/13] glibc port to ARC processors)

Joseph Myers joseph at codesourcery.com
Thu Jul 2 12:27:25 EDT 2020


On Thu, 2 Jul 2020, Vineet Gupta via Libc-alpha wrote:

> Now acos can come from 2 places depending on LIBM_SVID_COMPAT
>  - math/w_acos_template.c	<-- sets errno only

This wrapper, unlike the compat one, always calls __ieee754_acos 
(appropriately suffixed), relying on it to raise appropriate exceptions.  
The implementation in sysdeps/ieee754/dbl-64/e_asin.c raises the exception 
by doing an Inf / Inf computation.

    u.i[HIGH_HALF]=0x7ff00000;
    v.i[HIGH_HALF]=0x7ff00000;
    u.i[LOW_HALF]=0;
    v.i[LOW_HALF]=0;
    return u.x/v.x;

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95115

The right place to fix this is in GCC, to stop it constant-folding Inf / 
Inf when flag_trapping_math.  That should be a straightforward fix.

It would also be reasonable to change the above code to just "return 0.0 / 
0.0;", as a simpler, more idiomatic way of returning a NaN with "invalid" 
raised.  (Any code constructing infinities / NaNs via bit patterns likely 
predates built-in functions that can be used to represent such values 
directly.  Though the GCC bug means a literal replacement with "return 
__builtin_inf () / __builtin_inf ();" wouldn't fix the present problem.)

-- 
Joseph S. Myers
joseph at codesourcery.com



More information about the linux-snps-arc mailing list