[LLVMbugs] [Bug 18448] New: wrong code at -O1 (affecting clang trunk and 3.4 on x86_64-linux-gnu and MacOS X)

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Jan 11 16:10:16 PST 2014


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

            Bug ID: 18448
           Summary: wrong code at -O1 (affecting clang trunk and 3.4 on
                    x86_64-linux-gnu and MacOS X)
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          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 and 3.4 at -O1 in
32-bit mode (but not 64-bit mode) on x86_64-linux-gnu and MacOS X.

This is a regression from 3.3. 


$ clang-trunk -v
clang version 3.5 (trunk 199011)
Target: x86_64-unknown-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 -O0 -m32 small.c; a.out
8
$ clang-trunk -O1 -m64 small.c; a.out
8
$ clang-3.3 -O1 -m32 small.c; a.out
8
$             
$ clang-trunk -O1 -m32 small.c; a.out
0
$ clang-3.4 -O1 -m32 small.c; a.out
0
$ 


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


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

struct U
{
  int f1;
};

volatile struct U b;
int a, e;
long long c;
char d;

int
main ()
{
  for (c = -1; c < 8; c++)
    if (a)
      d != e && b.f1;
  printf ("%d\n", (int) 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/20140112/ae506354/attachment.html>


More information about the llvm-bugs mailing list