[LLVMbugs] [Bug 18045] New: clang crashes on valid code at -O2 and -O3 in 32-bit mode on x86_64-linux-gnu

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Nov 24 11:38:34 PST 2013


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

            Bug ID: 18045
           Summary: clang crashes on valid code at -O2 and -O3 in 32-bit
                    mode on x86_64-linux-gnu
           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 current clang trunk crashes when compiling the following testcase at -O2
and -O3 in 32-bit mode (but not 64-bit mode) on x86_64-linux-gnu. 

This is a regression from clang 3.3.

The "main" could certainly be removed, but beyond that, this is the simplest I
could get so far. 

$ clang-trunk -v
clang version 3.5 (trunk 195569)
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 -m32 -Os small.c; a.out
$ clang-trunk -m64 -O2 small.c; a.out
$ clang-3.3 -m32 -O2 small.c; a.out
$ 
$ clang-trunk -m32 -O2 small.c    
fatal error: error in backend: Cannot select: 0x4200920: v4i32,ch = load
0x41d6ab0, 0x4205850,
      0x41dcb10<LD16[getelementptr inbounds ([4 x i32]* @e, i32 0, i32
0)](align=4)> [ORD=82]
      [ID=58]
  0x4205850: i32 = X86ISD::Wrapper 0x41d5490 [ORD=26] [ID=43]
    0x41d5490: i32 = TargetGlobalAddress<[4 x i32]* @e> 0 [ORD=26] [ID=23]
  0x41dcb10: i32 = undef [ID=2]
In function: fn3
clang: error: clang frontend command failed with exit code 70 (use -v to see
invocation)
clang version 3.5 (trunk 195569)
Target: i386-unknown-linux-gnu
Thread model: posix
clang: note: diagnostic msg: PLEASE submit a bug report to
http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and
associated run script.
clang: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/small-85844e.c
clang: note: diagnostic msg: /tmp/small-85844e.sh
clang: note: diagnostic msg: 

********************
$ 


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


int a, b, c, d, e[4], f[4], g, h, i, j, l;
short k;

char
fn1 (int p)
{
  return p + a;
}

int
fn2 (int p1, int p2)
{
  return 1 ^ -p2 ^ p2 ? 0 : p1 - 1;
}

void
fn3 ()
{
  for (l = 0; l < 1; l++)
    if (i)
      for (h = 0; h < 4; h++)
    {
      k = c * d;
      j = k * b;
      f[h] = fn2 (e[h], 
              ((f[h] >= 0) <=
               (g >= fn1 (e[3] < (d = (j ^ 1) < 1)))) & e[h]);
    }
}

int
main ()
{
  fn3 ();
  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/20131124/75a07e40/attachment.html>


More information about the llvm-bugs mailing list