<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - clang crashes on valid code at -O3 on x86_64-linux-gnu"
   href="http://llvm.org/bugs/show_bug.cgi?id=19884">19884</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang crashes on valid code at -O3 on x86_64-linux-gnu
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>-New Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>su@cs.ucdavis.edu
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The current clang trunk crashes when compiling the following testcase at -O3 on
x86_64-linux-gnu in both 32-bit and 64-bit modes. 

This is a regression from clang 3.4.

Possibly related to 18861 (but 18861 also fails at -O2). 

$ clang-trunk -v
clang version 3.5.0 (trunk 209730)
Target: x86_64-unknown-linux-gnu
Thread model: posix
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.8.1
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
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64

$ 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/IndVarSimplify.cpp:1898: virtual bool
{anonymous}::IndVarSimplify::runOnLoop(llvm::Loop*, llvm::LPPassManager&):
Assertion `L->isLCSSAForm(*DT) && "Indvars did not leave the loop in lcssa
form!"' failed.
0  clang           0x00000000026b3452 llvm::sys::PrintStackTrace(_IO_FILE*) +
34
1  clang           0x00000000026b3039
2  libpthread.so.0 0x00007fbf3f797cb0
3  libc.so.6       0x00007fbf3e7bd425 gsignal + 53
4  libc.so.6       0x00007fbf3e7c0b8b abort + 379
5  libc.so.6       0x00007fbf3e7b60ee
6  libc.so.6       0x00007fbf3e7b6192
7  clang           0x00000000021dd862
8  clang           0x000000000241a647
llvm::LPPassManager::runOnFunction(llvm::Function&) + 1735
9  clang           0x000000000264287f
llvm::FPPassManager::runOnFunction(llvm::Function&) + 639
10 clang           0x000000000237db14
11 clang           0x0000000002643f0f
llvm::legacy::PassManagerImpl::run(llvm::Module&) + 863
12 clang           0x00000000008d68e8
clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions
const&, clang::TargetOptions const&, clang::LangOptions const&,
llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::raw_ostream*) +
3080
13 clang           0x00000000008d0bbf
14 clang           0x0000000000a9243a clang::ParseAST(clang::Sema&, bool, bool)
+ 490
15 clang           0x00000000008d3061 clang::CodeGenAction::ExecuteAction() +
97
16 clang           0x0000000000713966 clang::FrontendAction::Execute() + 182
17 clang           0x00000000006f3c7d
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 349
18 clang           0x00000000006d6c4c
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1564
19 clang           0x00000000006ce2a8 cc1_main(char const**, char const**, char
const*, void*) + 1240
20 clang           0x00000000006d4bad main + 797
21 libc.so.6       0x00007fbf3e7a876d __libc_start_main + 237
22 clang           0x00000000006ccf79
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/20140527-clang-m32-m64-O3-build-test25871/small.o
-resource-dir /usr/local/clang-trunk/bin/../lib/clang/3.5.0 -internal-isystem
/usr/local/include -internal-isystem
/usr/local/clang-trunk/bin/../lib/clang/3.5.0/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/20140527-clang-m32-m64-O3-build-test25871
-ferror-limit 19 -fmessage-length 180 -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 'Induction Variable Simplification' on basic block
'%for.condthread-pre-split'
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.0 (trunk 209730)
Target: x86_64-unknown-linux-gnu
Thread model: posix
clang: note: diagnostic msg: PLEASE submit a bug report to
<a href="http://llvm.org/bugs/">http://llvm.org/bugs/</a> 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-b0ad75.c
clang: note: diagnostic msg: /tmp/small-b0ad75.sh
clang: note: diagnostic msg: 

********************



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


int a, b, c, d, f, g, h, i;

void
fn1 ()
{
  int k[1] = { 0 };
l1:
  for (; b; b++)
    ;
l2:
  for (f = 0; f < 1; f++)
    for (; g;)
      i = k[0];
  if (i)
    goto l1;
  for (; c; c++)
    {
      if (a)
    goto l2;
      if (h)
    k[0] = b || d;
    }
}</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>