[LLVMbugs] [Bug 16184] New: incorrect code for loop at -O3 in 32-bit mode

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu May 30 11:13:18 PDT 2013


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

            Bug ID: 16184
           Summary: incorrect code for loop at -O3 in 32-bit mode
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: dhazeghi at yahoo.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

The following testcase is miscompiled on x86_64-linux when built at -O3 in
32-bit mode with current clang trunk.  This is a regression from clang 3.2
which handled this code correctly.

$ clang-trunk -v
clang version 3.4 (trunk 182920)
Target: x86_64-pc-linux-gnu
Thread model: posix
$ clang-trunk -O2 -m32 wrong.c 
$ ./a.out 
0
$ clang-3.2 -O3 -m32 wrong.c 
$ ./a.out 
0
$ clang-trunk -O3 -m32 wrong.c 
$ ./a.out 
4
$

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

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

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

static void f1 ( int *p ) {
  int i;
  for ( ; b <= 3; b++ ) {
    *p = 8;
    i = a || 1 < -a ? 1 : 0;
    *d = i | e && *p;
  }
}

int main (  ) {
  f1 ( &f );
  printf ( "%d\n", c );

  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/20130530/022f62fa/attachment.html>


More information about the llvm-bugs mailing list