[llvm-bugs] [Bug 38289] New: LLVM miscompiles long double to unsigned long long conversion

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jul 24 10:54:18 PDT 2018


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

            Bug ID: 38289
           Summary: LLVM miscompiles long double to unsigned long long
                    conversion
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: benny.kra at gmail.com
                CC: craig.topper at gmail.com, llvm-bugs at lists.llvm.org

$ cat fp.c
long double l = 10240000000000000256.000000L;

int main() {
  __builtin_printf("%llu\n", (unsigned long long)l);
}

$ clang -O0 fp.c && ./a.out
10240000000000000256
$ clang -O1 fp.c && ./a.out
10239999935508381696

This only happens when no ssse3 is available. This started failing with
r329339,
but the bug is probably older. What happens is that instructions get scheduled
over a x87 control word store.

-- 
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/20180724/a031eda6/attachment-0001.html>


More information about the llvm-bugs mailing list