[LLVMbugs] [Bug 17532] New: wrong code at -O2 and -O3 (vectorizer bug?)

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Oct 9 20:28:56 PDT 2013


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

            Bug ID: 17532
           Summary: wrong code at -O2 and -O3 (vectorizer bug?)
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: su at cs.ucdavis.edu
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

The following code is miscompiled by the current clang trunk at -O2 and -O3
(and clang 3.3 at -O3) on x86_64-linux-gnu in both 32-bit and 64-bit modes. 

This is a regression from clang 3.2, and disappears with -fno-vectorize. 


$ clang-trunk -v
clang version 3.4 (trunk 192279)
Target: x86_64-pc-linux-gnu
Thread model: posix
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4.6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6.3
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6
$ 
$ clang-trunk -Os small.c; a.out
0
$ clang-trunk -O2 small.c; a.out
1
$ clang-trunk -O3 small.c; a.out
1
$ clang-3.3 -O3 small.c; a.out
1
$ clang-3.3 -O2 small.c; a.out
0
$ clang-3.2 -O2 small.c; a.out
0
$ clang-3.2 -O3 small.c; a.out
0
$ 
$ clang-trunk -O2 -fno-vectorize small.c; a.out
0 
$ gcc-trunk -O2 small.c; a.out
0
$


---------------------------------------


int printf (const char *, ...);

int *a, *f, b = 1, e = 1;
static int **c = &a;
char d;

int
main ()
{
  int **g = &a;
  *c = &b;
  f = *g;
  int *h = f;
  char *i = &d;

 lbl:
  --*i;
  *h &= 1 % e;
  if (d)
    goto lbl;
  printf ("%d\n", b);
  return 0;
}

-- 
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/20131010/f2dc7c23/attachment.html>


More information about the llvm-bugs mailing list