[LLVMbugs] [Bug 18771] New: clang crashes on valid code at -O3 on x86_64-linux-gnu

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Feb 7 22:20:16 PST 2014


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

            Bug ID: 18771
           Summary: clang crashes on valid code at -O3 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 -O3 in
both 32-bit and 64-bit modes on x86_64-linux-gnu. 

This is a regression from clang 3.4. 

Perhaps related to the recently fixed 18688? 

$ clang-trunk -v
clang version 3.5 (trunk 201017)
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.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.1
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
$ 
$ clang-trunk -O2 -c small.c
$ clang-3.4 -O3 -c small.c
$ 
$ clang-trunk -O3 -c small.c
clang: /tmp/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:397: virtual bool
{anonymous}::LoopUnswitch::runOnLoop(llvm::Loop*, llvm::LPPassManager&):
Assertion `currentLoop->isLCSSAForm(*DT)' failed.
0  clang           0x0000000002599742 llvm::sys::PrintStackTrace(_IO_FILE*) +
34
1  clang           0x0000000002599329
2  libpthread.so.0 0x00007fa7643cdcb0
3  libc.so.6       0x00007fa7633f3425 gsignal + 53
4  libc.so.6       0x00007fa7633f6b8b abort + 379
5  libc.so.6       0x00007fa7633ec0ee
6  libc.so.6       0x00007fa7633ec192
7  clang           0x0000000002150d50
8  clang           0x00000000023306bf
llvm::LPPassManager::runOnFunction(llvm::Function&) + 1711
9  clang           0x00000000024843ff
llvm::FPPassManager::runOnFunction(llvm::Function&) + 639
10 clang           0x000000000229df16
11 clang           0x000000000248657f
llvm::legacy::PassManagerImpl::run(llvm::Module&) + 863
12 clang           0x00000000008bc468
clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions
const&, clang::TargetOptions const&, clang::LangOptions const&,
llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::raw_ostream*) +
2840
13 clang           0x00000000008b78de
14 clang           0x0000000000a5d612 clang::ParseAST(clang::Sema&, bool, bool)
+ 514
15 clang           0x00000000008b9211 clang::CodeGenAction::ExecuteAction() +
97
16 clang           0x0000000000708899 clang::FrontendAction::Execute() + 265
17 clang           0x00000000006e655d
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 349
18 clang           0x00000000006cbe9e
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1886
19 clang           0x00000000006c5a28 cc1_main(char const**, char const**, char
const*, void*) + 1208
20 clang           0x00000000006b08bc main + 716
21 libc.so.6       0x00007fa7633de76d __libc_start_main + 237
22 clang           0x00000000006c4731
Stack dump:
0.    Program arguments: /usr/local/clang-trunk/bin/clang -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -disable-free -main-file-name small.c
-mrelocation-model static -fmath-errno -masm-verbose -mconstructor-aliases
-munwind-tables -fuse-init-array -target-cpu x86-64 -target-linker-version 2.22
-momit-leaf-frame-pointer -coverage-file
/data2/c-hunter-results/C/trans-bugs/REDUCED/20140205-clang-m32-m64-O3-build-test188168/small.o
-resource-dir /usr/local/clang-trunk/bin/../lib/clang/3.5 -internal-isystem
/usr/local/include -internal-isystem
/usr/local/clang-trunk/bin/../lib/clang/3.5/include -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem /include
-internal-externc-isystem /usr/include -O3 -fdebug-compilation-dir
/data2/c-hunter-results/C/trans-bugs/REDUCED/20140205-clang-m32-m64-O3-build-test188168
-ferror-limit 19 -fmessage-length 126 -mstackrealign -fobjc-runtime=gcc
-fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp
-o small.o -x c small.c 
1.    <eof> parser at end of file
2.    Per-module optimization passes
3.    Running pass 'CallGraph Pass Manager' on module 'small.c'.
4.    Running pass 'Loop Pass Manager' on function '@fn1'
5.    Running pass 'Unswitch loops' on basic block
'%for.condthread-pre-split.i'
clang: error: unable to execute command: Aborted (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.5 (trunk 201017)
Target: x86_64-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-fd94fd.c
clang: note: diagnostic msg: /tmp/small-fd94fd.sh
clang: note: diagnostic msg: 

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


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


int b, d, e, g, h, k, l, m;

int 
fn2 ()
{
  int p, i;
lbl:
  for (; k < 1; k++)
    for (; e;)
      if (h)
    goto lbl;

  for (; g; g--)
    {
      if (b)
    goto lbl;

      for (; d; d++)
    for (p = 0; p < 1; p++)
      {
        for (; i; i++)
          ;
        m = k;
        if (l)
          return 0;
        i = 0;
      }
    }
  return 0;
}

void 
fn1 ()
{
  fn2 ();
}

-- 
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/20140208/224c8ee8/attachment.html>


More information about the llvm-bugs mailing list