<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 -O1 and above"
   href="https://bugs.llvm.org/show_bug.cgi?id=34791">34791</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang crashes at -O1 and above
          </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>There is no explicit assertion failure info in this case.

$ 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 -O1 abc.c
abc.c:31:3: warning: expression result unused [-Wunused-value]
  d;
  ^
#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 0x00007f966bfc3330 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
#4 0x0000000001b4a66e unsigned int
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock,
false> >::runDFS<false,
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock,
false> >::DeleteReachable(llvm::DominatorTreeBase<llvm::BasicBlock, false>&,
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock,
false> >::BatchUpdateInfo*, llvm::DomTreeNodeBase<llvm::BasicBlock>*,
llvm::DomTreeNodeBase<llvm::BasicBlock>*)::{lambda(llvm::BasicBlock*,
llvm::BasicBlock*)#1}>(llvm::BasicBlock*, unsigned int,
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock,
false> >::DeleteReachable(llvm::DominatorTreeBase<llvm::BasicBlock, false>&,
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock,
false> >::BatchUpdateInfo*, llvm::DomTreeNodeBase<llvm::BasicBlock>*,
llvm::DomTreeNodeBase<llvm::BasicBlock>*)::{lambda(llvm::BasicBlock*,
llvm::BasicBlock*)#1}, unsigned int)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x1b4a66e)
#5 0x0000000001b4c41c
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock,
false> >::DeleteReachable(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+0x1b4c41c)
#6 0x0000000001b4cf5e
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock,
false> >::DeleteEdge(llvm::DominatorTreeBase<llvm::BasicBlock, false>&,
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock,
false> >::BatchUpdateInfo*, llvm::BasicBlock*, llvm::BasicBlock*)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x1b4cf5e)
#7 0x0000000001b585dc
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+0x1b585dc)
#8 0x0000000001e92a92 llvm::JumpThreadingPass::ThreadEdge(llvm::BasicBlock*,
llvm::SmallVectorImpl<llvm::BasicBlock*> const&, llvm::BasicBlock*)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x1e92a92)
#9 0x0000000001e9325a
llvm::JumpThreadingPass::ProcessThreadableEdges(llvm::Value*,
llvm::BasicBlock*, llvm::jumpthreading::ConstantPreference, llvm::Instruction*)
[clone .part.568] (/home/absozero/trunk/root-clang/bin/clang-6.0+0x1e9325a)
#10 0x0000000001e941d3
llvm::JumpThreadingPass::ProcessThreadableEdges(llvm::Value*,
llvm::BasicBlock*, llvm::jumpthreading::ConstantPreference, llvm::Instruction*)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x1e941d3)
#11 0x0000000001e96bb9 llvm::JumpThreadingPass::ProcessBlock(llvm::BasicBlock*)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x1e96bb9)
#12 0x0000000001e97229 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+0x1e97229)
#13 0x0000000001e9803e (anonymous
namespace)::JumpThreading::runOnFunction(llvm::Function&) [clone .part.583]
[clone .constprop.600]
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x1e9803e)
#14 0x0000000001b9cd33 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x1b9cd33)
#15 0x000000000164203e (anonymous
namespace)::CGPassManager::runOnModule(llvm::Module&)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x164203e)
#16 0x0000000001b9c8cd llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x1b9c8cd)
#17 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)
#18 0x0000000002a106b7
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x2a106b7)
#19 0x0000000002bedc98 clang::ParseAST(clang::Sema&, bool, bool)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x2bedc98)
#20 0x0000000002a0fa6c clang::CodeGenAction::ExecuteAction()
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x2a0fa6c)
#21 0x00000000025a941e clang::FrontendAction::Execute()
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x25a941e)
#22 0x0000000002578b96
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x2578b96)
#23 0x000000000263c503
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x263c503)
#24 0x0000000000a455b8 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/home/absozero/trunk/root-clang/bin/clang-6.0+0xa455b8)
#25 0x00000000009c4375 main
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x9c4375)
#26 0x00007f966ab2bf45 __libc_start_main
/build/eglibc-oGUzwX/eglibc-2.19/csu/libc-start.c:321:0
#27 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 -O1
-fdebug-compilation-dir /home/absozero/projects/reduction/crash -ferror-limit
19 -fmessage-length 172 -fobjc-runtime=gcc -fdiagnostics-show-option
-fcolor-diagnostics -o /tmp/abc-dded0f.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: Segmentation fault (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-e1f2c2.c
clang-6.0: note: diagnostic msg: /tmp/abc-e1f2c2.sh
clang-6.0: note: diagnostic msg:

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


$ cat abc.c
long a;
short b;
int c, d, e;
char *f;
void fn1() {
  for (; a;)
  l1:
  for (; a;) {
    long g;
    if (c) {
    l2:
      a = e ? *f : 0;
      c = 8;
      for (; c <= 67;) {
        c = 3;
        for (; c;)
          ;
        d = 4;
        for (; c;)
          goto l1;
      }
      if (a)
      l3:;
    }
    char h;
    if (b) {
      g %= e;
      goto l3;
    }
  }
  d;
  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>