[llvm-bugs] [Bug 26931] x87 single precision float underflow hidden (by incorrect double precision store?)

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Mar 14 11:09:27 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=26931

Richard Smith <richard-llvm at metafoo.co.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |richard-llvm at metafoo.co.uk
         Resolution|---                         |DUPLICATE

--- Comment #2 from Richard Smith <richard-llvm at metafoo.co.uk> ---
(In reply to comment #0)
> int main(void)
> {
>   float x;
>   feclearexcept(FE_ALL_EXCEPT);
>   x = foo();
>   if (fetestexcept(FE_UNDERFLOW))
>     printf("FE_UNDERFLOW: ");
>   printf("x = %e\n", x);
>   return 0;
> }

This testcase has undefined behavior. You can't use these fe* functions outside
of a region marked with #pragma STDC FENV_ACCESS ON.

See C11 7.6.1/2: "If part of a program tests floating-point status flags, sets
floating-point control modes, or runs under non-default mode settings, but was
translated with the state for the FENV_ACCESS pragma โ€˜โ€˜offโ€™โ€™, the behavior is
undefined."

Clang doesn't yet support #pragma FENV_ACCESS, which is PR8100.

*** This bug has been marked as a duplicate of bug 8100 ***

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160314/f06b0f44/attachment.html>


More information about the llvm-bugs mailing list