<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><span class="vcard"><a class="email" href="mailto:richard-llvm@metafoo.co.uk" title="Richard Smith <richard-llvm@metafoo.co.uk>"> <span class="fn">Richard Smith</span></a>
</span> changed
              <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED DUPLICATE - x87 single precision float underflow hidden (by incorrect double precision store?)"
   href="https://llvm.org/bugs/show_bug.cgi?id=26931">bug 26931</a>
        <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">Status</td>
           <td>NEW
           </td>
           <td>RESOLVED
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">CC</td>
           <td>
                
           </td>
           <td>richard-llvm@metafoo.co.uk
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Resolution</td>
           <td>---
           </td>
           <td>DUPLICATE
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED DUPLICATE - x87 single precision float underflow hidden (by incorrect double precision store?)"
   href="https://llvm.org/bugs/show_bug.cgi?id=26931#c2">Comment # 2</a>
              on <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED DUPLICATE - x87 single precision float underflow hidden (by incorrect double precision store?)"
   href="https://llvm.org/bugs/show_bug.cgi?id=26931">bug 26931</a>
              from <span class="vcard"><a class="email" href="mailto:richard-llvm@metafoo.co.uk" title="Richard Smith <richard-llvm@metafoo.co.uk>"> <span class="fn">Richard Smith</span></a>
</span></b>
        <pre>(In reply to <a href="show_bug.cgi?id=26931#c0">comment #0</a>)
<span class="quote">> 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;
> }</span >

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 <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - clang/llvm don't support C99 FP rounding mode pragmas (FENV_ACCESS etc)"
   href="show_bug.cgi?id=8100">bug 8100</a> ***</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>