[LLVMbugs] [Bug 18927] New: Opt incorrectly optimizes pr41454 from gcc testsuite

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Feb 21 06:15:23 PST 2014


            Bug ID: 18927
           Summary: Opt incorrectly optimizes pr41454 from gcc testsuite
           Product: tools
           Version: 3.4
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: opt
          Assignee: unassignedbugs at nondot.org
          Reporter: ihusar at fit.vutbr.cz
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 12099
  --> http://llvm.org/bugs/attachment.cgi?id=12099&action=edit
test c file

The code in attachment 

#define OFFS 12

int main ()
  int BM_tab2[OFFS];
  int *BM_tab = BM_tab2;
  int *BM_tab_base;

  BM_tab_base = BM_tab;
  BM_tab += OFFS;
  while (BM_tab_base != BM_tab)
      *--BM_tab = 6;
      *--BM_tab = 6;
  if (BM_tab2[0] != 6)
    abort ();
  return 0;

get incorrectly optimized by opt -O3 to 

; Function Attrs: nounwind uwtable
define i32 @main() #0 {
  call void @abort() #2

Strange is that when I change OFFS to e.g. 2, 4, 6, 8, 10 then it works
correctly. Values 12, 14, 16, ... cause this test be optimized only to the
abort call. With gcc this test works fine.

I used clang and opt with -O3:

clang version 3.4 (tags/RELEASE_34/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix

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/20140221/791f2392/attachment.html>

More information about the llvm-bugs mailing list