[llvm-bugs] [Bug 27712] New: wrong code bug

via llvm-bugs llvm-bugs at lists.llvm.org
Wed May 11 07:10:47 PDT 2016


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

            Bug ID: 27712
           Summary: wrong code bug
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: regehr at cs.utah.edu
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Sorry for the sucky test case, this is the best C-Reduce could do...

Johns-MacBook-Pro-2:reduce_wrong_719369 regehr$ clang -O0 small.c -w ; ./a.out 
2
Johns-MacBook-Pro-2:reduce_wrong_719369 regehr$ gcc -O small.c -w ; ./a.out 
2
Johns-MacBook-Pro-2:reduce_wrong_719369 regehr$ clang -O small.c -w ; ./a.out 
0
Johns-MacBook-Pro-2:reduce_wrong_719369 regehr$ cat small.c
int printf(const char *, ...);
int a;
int b[3];
short c;
char d;
int main() {
  {
    char e;
    unsigned f;
    b[2] = d = 137;
    b[0] = d;
  lbl_1154:
    for (;; a++)
      if (b[a])
        break;
    e = b[0] < 0 ?: 2 << b[0];
    f = e;
    c = f < 2;
    if (c) {
      b[0] = 0;
      goto lbl_1154;
    }
  }
  printf("%d\n", a);
  return 0;
}
Johns-MacBook-Pro-2:reduce_wrong_719369 regehr$ clang -v
clang version 3.9.0 (trunk 269180)
Target: x86_64-apple-darwin15.4.0
Thread model: posix
InstalledDir: /Users/regehr/llvm-install/bin

-- 
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/20160511/5d2766c4/attachment-0001.html>


More information about the llvm-bugs mailing list