<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Wrong optimization: instability of x87 floating-point results leads to nonsense"
   href="https://bugs.llvm.org/show_bug.cgi?id=44873">44873</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Wrong optimization: instability of x87 floating-point results leads to nonsense
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>ch3root@openwall.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>x87 floating-point results are effectively unstable due to possible excess
precision. Without extra care, this instability can taint everything around and
lead to nonsense.

Instability is not limited to FP numbers, it extends to integers too:

----------------------------------------------------------------------
#include <stdio.h>

__attribute__((noipa,optnone)) // imagine it in a separate TU
static int opaque(int i) { return i; }

int main()
{
    int z = opaque(1) + 0x1p-60 == 1;

    printf("z = %d\n", z);
    if (z) 
        puts("z is one");
}
----------------------------------------------------------------------
$ clang -std=c11 -pedantic -Wall -Wextra -Wno-unknown-attributes -m32
-march=i686 -O3 test.c && ./a.out
z = 0
z is one
----------------------------------------------------------------------
clang x86-64 version: clang version 11.0.0
(<a href="https://github.com/llvm/llvm-project">https://github.com/llvm/llvm-project</a> 14ecbd7b8ded18af6c95f6a9957da541d1ec0e80)
----------------------------------------------------------------------</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>