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: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to