<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - crash at -O2 and -O3 in both 32-bit and 64-bit on x86_64-linux-gnu (DominatorTree is not up to date!)"
   href="https://bugs.llvm.org/show_bug.cgi?id=32245">32245</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>crash at -O2 and -O3 in both 32-bit and 64-bit on x86_64-linux-gnu (DominatorTree is not up to date!)
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>enhancement
          </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>chengniansun@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>$ clang-trunk -v
clang version 5.0.0 (trunk 297562)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5.3.0
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.5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.2
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.3.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64

$ clang-trunk -w small.c -O3
DominatorTree is not up to date!
Computed:
=============================--------------------------------
Inorder Dominator Tree: DFSNumbers invalid: 19 slow queries.
  [1] %entry {0,15}
    [2] %for.cond.outer.peel.begin {4294967295,4294967295}
      [3] %for.cond.outer.peel {4294967295,4294967295}
        [4] %if.then.i.split.peel {4294967295,4294967295}
          [5] %for.condthread-pre-split.i.peel {4294967295,4294967295}
          [5] %while.condthread-pre-split.i.peel {4294967295,4294967295}
          [5] %while.cond.i.peel {4294967295,4294967295}
            [6] %while.body.i.peel {4294967295,4294967295}
            [6] %for.cond.outer.peel.next {4294967295,4294967295}
              [7] %for.cond.outer.peel.next4 {4294967295,4294967295}
                [8] %entry.peel.newph {4294967295,4294967295}
                  [9] %for.cond.outer {1,14}
                    [10] %if.then.i.split {2,11}
                      [11] %for.condthread-pre-split.i {3,4}
                      [11] %while.condthread-pre-split.i {5,6}
                      [11] %while.cond.i {7,10}
                        [12] %while.body.i {8,9}
                    [10] %for.cond.preheader.loopexit {4294967295,4294967295}
            [6] %for.cond.preheader {4294967295,4294967295}
              [7] %for.cond {12,13}

Actual:
=============================--------------------------------
Inorder Dominator Tree: 
  [1] %entry {0,35}
    [2] %for.cond.outer.peel.begin {1,34}
      [3] %for.cond.outer.peel {2,33}
        [4] %if.then.i.split.peel {3,28}
          [5] %for.condthread-pre-split.i.peel {4,7}
            [6] %while.condthread-pre-split.i.peel {5,6}
          [5] %while.cond.i.peel {8,27}
            [6] %for.cond.outer.peel.next {9,26}
              [7] %for.cond.outer.peel.next4 {10,25}
                [8] %entry.peel.newph {11,24}
                  [9] %for.cond.outer {12,23}
                    [10] %if.then.i.split {13,20}
                      [11] %for.condthread-pre-split.i {14,17}
                        [12] %while.condthread-pre-split.i {15,16}
                      [11] %while.cond.i {18,19}
                    [10] %for.cond.preheader.loopexit {21,22}
        [4] %for.cond.preheader {29,32}
          [5] %for.cond {30,31}
#0 0x0000000001efdfca llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/clang-trunk/bin/clang-5.0+0x1efdfca)
#1 0x0000000001efbfde llvm::sys::RunSignalHandlers()
(/usr/local/clang-trunk/bin/clang-5.0+0x1efbfde)
#2 0x0000000001efc142 SignalHandler(int)
(/usr/local/clang-trunk/bin/clang-5.0+0x1efc142)
#3 0x00007ff743b25330 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
#4 0x00007ff742916c37 gsignal
/build/eglibc-oGUzwX/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x00007ff74291a028 abort
/build/eglibc-oGUzwX/eglibc-2.19/stdlib/abort.c:91:0
#6 0x0000000001aa68ad llvm::DominatorTree::verifyDomTree() const
(/usr/local/clang-trunk/bin/clang-5.0+0x1aa68ad)
#7 0x0000000001f6936d llvm::UnrollLoop(llvm::Loop*, unsigned int, unsigned int,
bool, bool, bool, bool, bool, unsigned int, unsigned int, llvm::LoopInfo*,
llvm::ScalarEvolution*, llvm::DominatorTree*, llvm::AssumptionCache*,
llvm::OptimizationRemarkEmitter*, bool)
(/usr/local/clang-trunk/bin/clang-5.0+0x1f6936d)
#8 0x0000000001dea160 tryToUnrollLoop(llvm::Loop*, llvm::DominatorTree&,
llvm::LoopInfo*, llvm::ScalarEvolution*, llvm::TargetTransformInfo const&,
llvm::AssumptionCache&, llvm::OptimizationRemarkEmitter&, bool, int,
llvm::Optional<unsigned int>, llvm::Optional<unsigned int>,
llvm::Optional<bool>, llvm::Optional<bool>, llvm::Optional<bool>)
(/usr/local/clang-trunk/bin/clang-5.0+0x1dea160)
#9 0x0000000001dea8ba (anonymous namespace)::LoopUnroll::runOnLoop(llvm::Loop*,
llvm::LPPassManager&) (/usr/local/clang-trunk/bin/clang-5.0+0x1dea8ba)
#10 0x0000000001688287 llvm::LPPassManager::runOnFunction(llvm::Function&)
(/usr/local/clang-trunk/bin/clang-5.0+0x1688287)
#11 0x0000000001ae6873 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/usr/local/clang-trunk/bin/clang-5.0+0x1ae6873)
#12 0x000000000287451f (anonymous
namespace)::CGPassManager::runOnModule(llvm::Module&)
(/usr/local/clang-trunk/bin/clang-5.0+0x287451f)
#13 0x0000000001ae75af llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/usr/local/clang-trunk/bin/clang-5.0+0x1ae75af)
#14 0x000000000208e36a (anonymous
namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
(/usr/local/clang-trunk/bin/clang-5.0+0x208e36a)
#15 0x000000000208f653 clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::HeaderSearchOptions const&, clang::CodeGenOptions const&,
clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout
const&, llvm::Module*, clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
(/usr/local/clang-trunk/bin/clang-5.0+0x208f653)
#16 0x00000000027121ec
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/usr/local/clang-trunk/bin/clang-5.0+0x27121ec)
#17 0x0000000002ad9522 clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/clang-trunk/bin/clang-5.0+0x2ad9522)
#18 0x0000000002710b8a clang::CodeGenAction::ExecuteAction()
(/usr/local/clang-trunk/bin/clang-5.0+0x2710b8a)
#19 0x00000000023f0a26 clang::FrontendAction::Execute()
(/usr/local/clang-trunk/bin/clang-5.0+0x23f0a26)
#20 0x00000000023cb056
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/clang-trunk/bin/clang-5.0+0x23cb056)
#21 0x000000000247c384
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/clang-trunk/bin/clang-5.0+0x247c384)
#22 0x0000000000b247b8 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/local/clang-trunk/bin/clang-5.0+0xb247b8)
#23 0x0000000000ac5a11 main (/usr/local/clang-trunk/bin/clang-5.0+0xac5a11)
#24 0x00007ff742901f45 __libc_start_main
/build/eglibc-oGUzwX/eglibc-2.19/csu/libc-start.c:321:0
#25 0x0000000000b20079 _start (/usr/local/clang-trunk/bin/clang-5.0+0xb20079)
Stack dump:
0.      Program arguments: /usr/local/clang-trunk/bin/clang-5.0 -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -disable-free -main-file-name small.c
-mrelocation-model static -mthread-model posix -fmath-errno -masm-verbose
-mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64
-momit-leaf-frame-pointer -dwarf-column-info -debugger-tuning=gdb -resource-dir
/usr/local/clang-trunk/lib/clang/5.0.0 -c-isystem . -c-isystem
/usr/local/include/csmith-2.2.0/ -c-isystem /usr/local/include/csmith-2.2.0/
-internal-isystem /usr/local/include -internal-isystem
/usr/local/clang-trunk/lib/clang/5.0.0/include -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem /include
-internal-externc-isystem /usr/include -O3 -w -fdebug-compilation-dir
/home/cnsun/ramdisk/hermes/run-3/res/20170307-clang-trunk-m32-Weverything-g-O3-build-060623/delta
-ferror-limit 19 -fmessage-length 132 -fobjc-runtime=gcc
-fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp
-o /tmp/small-3ec7dc.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 '@main'
5.      Running pass 'Unroll loops' on basic block '%for.cond.outer'
clang-5.0: error: unable to execute command: Aborted (core dumped)
clang-5.0: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 5.0.0 (trunk 297562)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
clang-5.0: 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-5.0: note: diagnostic msg: 
********************

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

********************
$  cat small.c
int a, b, c;
void fn1() {
  if (a <= 3) {
    if (a < 0)
      for (b; b; b++)
        ;
    while (a == 1)
      c--;
    a = 0;
  }
}

int main() {
  for (;;)
    fn1();
}</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>