[llvm-bugs] [Bug 25385] New: Condition not evaluated correctly on integer (long long) overflow for optimized builds

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Nov 2 14:59:14 PST 2015


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

            Bug ID: 25385
           Summary: Condition not evaluated correctly on integer (long
                    long) overflow for optimized builds
           Product: compiler-rt
           Version: 3.5
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: compiler-rt
          Assignee: unassignedbugs at nondot.org
          Reporter: jhallmann at tableau.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 15205
  --> https://llvm.org/bugs/attachment.cgi?id=15205&action=edit
Code to repo the defect

Staring with llvm 3.5 the optimizer is not correctly evaluation the condition
if an overflow happens.

# Compile
clang++ test.cpp -O3 -o testr && clang++ test.cpp -o testd

# Run and the outputs should match
./testd && ./testr
overflows 1
overflows 0

llvm 3.4

.Ltmp16:
    #DEBUG_VALUE: delta <- ECX
    .loc    1 24 0
    setl    r9b
    setg    r10b
    .loc    1 21 0
    test    ecx, ecx
    .loc    1 22 0
    setg    al
    .loc    1 23 0
    shr    ecx, 31

llvm 3.5 - 3.7

.Ltmp13:
    #DEBUG_VALUE: value <- R8D
    .loc    6 22 17
    mov    ecx, r8d
    sub    ecx, r9d
    setg    r9b
    .loc    6 24 17
    setl    al
    .loc    6 23 17
    shr    ecx, 31

-- 
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/20151102/0e5a38cb/attachment.html>


More information about the llvm-bugs mailing list