[llvm-bugs] [Bug 51175] New: wrong code at -O3 on x86_64-linux-gnu

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jul 22 21:48:07 PDT 2021


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

            Bug ID: 51175
           Summary: wrong code at -O3 on x86_64-linux-gnu
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: qrzhang at gatech.edu
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

It appears to be a latent issue. It affects all versions since clang-7.


$ clang-trunk -v
clang version 13.0.0 (https://github.com/llvm/llvm-project.git
599b2f00370ee79e812d2776f2af57fae36d02e9)


$ clang-trunk abc.c ; ./a.out
4

$ clang-trunk -O3 abc.c ; ./a.out
0

$ clang-7 -O3 abc.c ; ./a.out
0


$ cat abc.c
short a = -1;
short c = 4;
int b;
int main() {
  char d;
  b = 65527 & ++a;
  d = 0 == 0 ? b : 0;
  if (d)
    c = 0;
  printf("%d\n", c);
}

-- 
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/20210723/f56f10fc/attachment.html>


More information about the llvm-bugs mailing list