[llvm-bugs] [Bug 35765] New: "X86 DAG->DAG Instruction Selection on function" triggers wrong code

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Dec 28 03:11:21 PST 2017


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

            Bug ID: 35765
           Summary: "X86 DAG->DAG Instruction Selection on function"
                    triggers wrong code
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: babokin at gmail.com
                CC: llvm-bugs at lists.llvm.org

clang trunk, x86_64, rev321482

> cat f.cpp
struct S {
    unsigned short m : 11;
};
long long int ll;
S s1 = { 1403 };
long long int x = 2651237805702985558L;
S s2 = { 902 };


void foo() {
  ll = (4 << (s1.m - 1398)) ^ (unsigned short)(x | ~s2.m);
}

int main() {
    foo();
    __builtin_printf("%lld\n", ll);
    return 0;
}

> clang++ f.cpp -std=c++11 -o out -O0; ./out
65535
> clang++ f.cpp -std=c++11 -o out -O2; ./out
-1

clang 5.0 produces correct result, so this is regression.

-- 
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/20171228/ca441c64/attachment.html>


More information about the llvm-bugs mailing list