[LLVMbugs] [Bug 22795] New: miscompile with -O2 (suspected incorrect loop trip count computation)

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Mar 4 11:47:03 PST 2015


http://llvm.org/bugs/show_bug.cgi?id=22795

            Bug ID: 22795
           Summary: miscompile with -O2 (suspected incorrect loop trip
                    count computation)
           Product: new-bugs
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: kcc at google.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

% cat z.cc 
#include <stdio.h>
#include <stdint.h>
#include <string.h>
int main(int argc, char **argv) {
  const int n = 16;
  int64_t bins[n] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
  for (int ix = 0; ix < n; ++ix)
    for (int jx = 0; jx < ix; ++jx)
      bins[ix]++;
  fprintf(stderr, "%ld\n", bins[10]);
}
% clang++ -O1  z.cc   && ./a.out 
10
% clang++ -O2  z.cc   && ./a.out 
4294967306
% 

Something is messed up in computation of the loop trip count. 
This is r231268 on x86_64 linux.

-- 
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/20150304/83331022/attachment.html>


More information about the llvm-bugs mailing list