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

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Aug 18 22:22:24 PDT 2021


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

            Bug ID: 51531
           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 recent regression.

$ clang-trunk -v
clang version 14.0.0 (https://github.com/llvm/llvm-project.git
4f5ba46e162eec32a9f9e2a725e6422281913043)

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

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



$ cat abc.c
int a, c, d;
char e, f;
char(g)(char h, char i) { return i == 0 || h == -128 && i == 1 ? h : h % i; }
char k() {
  int j;
  d = 3;
  for (;; d--)
    for (;;) {
      short b = g(d, e | d);
      j = !b + 1;
      f = (1 == b) * j;
      c = b;
      if (d)
        break;
      return 1;
    }
}
int main() {
  k();
  printf("%X\n", a);
}

-- 
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/20210819/bc33f9c8/attachment.html>


More information about the llvm-bugs mailing list