https://bugs.llvm.org/show_bug.cgi?id=44873
Bug ID: 44873
Summary: Wrong optimization: instability of x87 floating-point
results leads to nonsense
Product: new-bugs
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: new bugs
Assignee: unassignedb...@nondot.org
Reporter: ch3r...@openwall.com
CC: htmldevelo...@gmail.com, llvm-bugs@lists.llvm.org
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
(https://github.com/llvm/llvm-project 14ecbd7b8ded18af6c95f6a9957da541d1ec0e80)
----------------------------------------------------------------------
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs