ARC math test regressions (was Re: [PATCH v7 00/13] glibc port to ARC processors)
Vineet Gupta
Vineet.Gupta1 at synopsys.com
Thu Jul 2 13:45:47 EDT 2020
On 7/2/20 9:27 AM, Joseph Myers wrote:
> 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
Aha. I almost forgot that this was upstream gcc-10 for ARC too (and problem
doesn't happen with gcc-9). So my glibc updates didn't trigger this, phew !
> 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.)
More information about the linux-snps-arc
mailing list