<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 - clang crashes at -O3: Assertion `SuccTN && "Unreachable successor found at reachable insertion"' failed."
   href="https://bugs.llvm.org/show_bug.cgi?id=34790">34790</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang crashes at -O3: Assertion `SuccTN && "Unreachable successor found at reachable insertion"' failed.
          </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>All
          </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>LLVM Codegen
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>helloqirun@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 6.0.0 (trunk 314585)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin


$ clang-trunk -O3 abc.c
abc.c:15:11: warning: implicit declaration of function 'fn2' is invalid in C99
[-Wimplicit-function-declaration]
          fn2();
          ^
abc.c:42:1: warning: control may reach end of non-void function [-Wreturn-type]
}
^
clang-6.0:
/home/absozero/trunk/llvm/include/llvm/Support/GenericDomTreeConstruction.h:786:
static void
llvm::DomTreeBuilder::SemiNCAInfo<DomTreeT>::VisitInsertion(DomTreeT&,
llvm::DomTreeBuilder::SemiNCAInfo<DomTreeT>::BatchUpdatePtr,
llvm::DomTreeBuilder::SemiNCAInfo<DomTreeT>::TreeNodePtr, unsigned int,
llvm::DomTreeBuilder::SemiNCAInfo<DomTreeT>::TreeNodePtr,
llvm::DomTreeBuilder::SemiNCAInfo<DomTreeT>::InsertionInfo&) [with DomTreeT =
llvm::DominatorTreeBase<llvm::BasicBlock, false>;
llvm::DomTreeBuilder::SemiNCAInfo<DomTreeT>::BatchUpdatePtr =
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock,
false> >::BatchUpdateInfo*;
llvm::DomTreeBuilder::SemiNCAInfo<DomTreeT>::TreeNodePtr =
llvm::DomTreeNodeBase<llvm::BasicBlock>*; typename DomTreeT::NodeType =
llvm::BasicBlock]: Assertion `SuccTN && "Unreachable successor found at
reachable insertion"' failed.
#0 0x000000000204f42a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x204f42a)
#1 0x000000000204d2ce llvm::sys::RunSignalHandlers()
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x204d2ce)
#2 0x000000000204d422 SignalHandler(int)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x204d422)
#3 0x00007f3e3611a330 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
#4 0x00007f3e34c97c37 gsignal
/build/eglibc-oGUzwX/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x00007f3e34c9b028 abort
/build/eglibc-oGUzwX/eglibc-2.19/stdlib/abort.c:91:0
#6 0x00007f3e34c90bf6 __assert_fail_base
/build/eglibc-oGUzwX/eglibc-2.19/assert/assert.c:92:0
#7 0x00007f3e34c90ca2 (/lib/x86_64-linux-gnu/libc.so.6+0x2fca2)
#8 0x0000000001b54098
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock,
false> >::VisitInsertion(llvm::DominatorTreeBase<llvm::BasicBlock, false>&,
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock,
false> >::BatchUpdateInfo*, llvm::DomTreeNodeBase<llvm::BasicBlock>*, unsigned
int, llvm::DomTreeNodeBase<llvm::BasicBlock>*,
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock,
false> >::InsertionInfo&)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x1b54098)
#9 0x0000000001b5422f
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock,
false> >::InsertReachable(llvm::DominatorTreeBase<llvm::BasicBlock, false>&,
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock,
false> >::BatchUpdateInfo*, llvm::DomTreeNodeBase<llvm::BasicBlock>*,
llvm::DomTreeNodeBase<llvm::BasicBlock>*)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x1b5422f)
#10 0x0000000001b54624
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock,
false> >::InsertUnreachable(llvm::DominatorTreeBase<llvm::BasicBlock, false>&,
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock,
false> >::BatchUpdateInfo*, llvm::DomTreeNodeBase<llvm::BasicBlock>*,
llvm::BasicBlock*) (/home/absozero/trunk/root-clang/bin/clang-6.0+0x1b54624)
#11 0x0000000001b588ae
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock,
false> >::ApplyUpdates(llvm::DominatorTreeBase<llvm::BasicBlock, false>&,
llvm::ArrayRef<llvm::DomTreeBuilder::Update<llvm::BasicBlock*> >)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x1b588ae)
#12 0x00000000020b984a
llvm::TryToSimplifyUncondBranchFromEmptyBlock(llvm::BasicBlock*,
llvm::DominatorTree*) (/home/absozero/trunk/root-clang/bin/clang-6.0+0x20b984a)
#13 0x0000000001e97706 llvm::JumpThreadingPass::runImpl(llvm::Function&,
llvm::TargetLibraryInfo*, llvm::LazyValueInfo*, llvm::AAResults*,
llvm::DominatorTree*, bool, std::unique_ptr<llvm::BlockFrequencyInfo,
std::default_delete<llvm::BlockFrequencyInfo> >,
std::unique_ptr<llvm::BranchProbabilityInfo,
std::default_delete<llvm::BranchProbabilityInfo> >)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x1e97706)
#14 0x0000000001e9803e (anonymous
namespace)::JumpThreading::runOnFunction(llvm::Function&) [clone .part.583]
[clone .constprop.600]
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x1e9803e)
#15 0x0000000001b9cd33 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x1b9cd33)
#16 0x000000000164203e (anonymous
namespace)::CGPassManager::runOnModule(llvm::Module&)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x164203e)
#17 0x0000000001b9c8cd llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x1b9c8cd)
#18 0x00000000021fd946 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> >)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x21fd946)
#19 0x0000000002a106b7
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x2a106b7)
#20 0x0000000002bedc98 clang::ParseAST(clang::Sema&, bool, bool)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x2bedc98)
#21 0x0000000002a0fa6c clang::CodeGenAction::ExecuteAction()
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x2a0fa6c)
#22 0x00000000025a941e clang::FrontendAction::Execute()
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x25a941e)
#23 0x0000000002578b96
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x2578b96)
#24 0x000000000263c503
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x263c503)
#25 0x0000000000a455b8 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/home/absozero/trunk/root-clang/bin/clang-6.0+0xa455b8)
#26 0x00000000009c4375 main
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x9c4375)
#27 0x00007f3e34c82f45 __libc_start_main
/build/eglibc-oGUzwX/eglibc-2.19/csu/libc-start.c:321:0
#28 0x0000000000a41ac9 _start
(/home/absozero/trunk/root-clang/bin/clang-6.0+0xa41ac9)
Stack dump:
0.      Program arguments: /home/absozero/trunk/root-clang/bin/clang-6.0 -cc1
-triple x86_64-unknown-linux-gnu -emit-obj -disable-free -main-file-name abc.c
-mrelocation-model static -mthread-model posix -fmath-errno -masm-verbose
-mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64
-dwarf-column-info -debugger-tuning=gdb -momit-leaf-frame-pointer -resource-dir
/home/absozero/trunk/root-clang/lib/clang/6.0.0 -internal-isystem
/usr/local/include -internal-isystem
/home/absozero/trunk/root-clang/lib/clang/6.0.0/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include -O3
-fdebug-compilation-dir /home/absozero/projects/reduction/crash -ferror-limit
19 -fmessage-length 172 -fobjc-runtime=gcc -fdiagnostics-show-option
-fcolor-diagnostics -vectorize-loops -vectorize-slp -o /tmp/abc-1ec315.o -x c
abc.c
1.      <eof> parser at end of file
2.      Per-module optimization passes
3.      Running pass 'CallGraph Pass Manager' on module 'abc.c'.
4.      Running pass 'Jump Threading' on function '@fn1'
clang-6.0: error: unable to execute command: Aborted (core dumped)
clang-6.0: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 6.0.0 (trunk 314585)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
clang-6.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-6.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-6.0: note: diagnostic msg: /tmp/abc-c30f11.c
clang-6.0: note: diagnostic msg: /tmp/abc-c30f11.sh
clang-6.0: note: diagnostic msg:

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


$ cat abc.c
int a, c, g, h, j;
short b, d, f, i;
char e;
short fn1() {
  int k = 0;
  char l;
l1:
l2:
  for (b = 0; b < 2; ++b) {
    int m;
    if (i) {
      a = 6;
      for (; a;)
        if (k)
          fn2();
      return m;
    }
  }
  for (; h;) {
    int n = 5;
    for (; n; n--) {
      g = 0;
      for (; g <= 5; g++)
        for (; c >= 0;) {
          for (;;) {
            int o;
            if (d)
              break;
            return f;
          }
          for (; l; l--)
            k = 1;
        }
    }
    for (; c >= 0;) {
      for (; j; j++)
        for (; e; e++)
          ;
      goto l2;
    }
  }
}</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>