<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 on valid code at -Os and above on x86_64-linux-gnu: Assertion `!IsSuccessor(To, From) && "Deleted edge still exists in the CFG!"' failed"
   href="https://bugs.llvm.org/show_bug.cgi?id=34785">34785</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang crashes on valid code at -Os and above on x86_64-linux-gnu: Assertion `!IsSuccessor(To, From) && "Deleted edge still exists in the CFG!"' failed
          </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>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>su@cs.ucdavis.edu
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>This is tested with rev. 314502. 


$ clangpolly -v
clang version 6.0.0 (<a href="http://llvm.org/git/clang.git">http://llvm.org/git/clang.git</a>
94efed908a60ba04964f220f0822e3463d0dcc38) (<a href="http://llvm.org/git/llvm.git">http://llvm.org/git/llvm.git</a>
8ba98f908f0e471a51ed73bc847bc778af024eab)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/su/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5.4.0
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/6.0.0
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.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.4
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.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.4.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.0.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.0
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
$
$ clangpolly -O1 -w small.c
$
$ clangpolly -Os -w small.c
clang-6.0:
/home/su/software/tmp/polly/llvm/include/llvm/Support/GenericDomTreeConstruction.h:906:
static void llvm::DomTreeBuilder::SemiNCAInfo<DomTreeT>::DeleteEdge(DomTreeT&,
llvm::DomTreeBuilder::SemiNCAInfo<DomTreeT>::BatchUpdatePtr,
llvm::DomTreeBuilder::SemiNCAInfo<DomTreeT>::NodePtr,
llvm::DomTreeBuilder::SemiNCAInfo<DomTreeT>::NodePtr) [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>::NodePtr = llvm::BasicBlock*]:
Assertion `!IsSuccessor(To, From) && "Deleted edge still exists in the CFG!"'
failed.
#0 0x000000000202aafa llvm::sys::PrintStackTrace(llvm::raw_ostream&)
/home/su/software/tmp/polly/llvm/lib/Support/Unix/Signals.inc:402:0
#1 0x000000000202896e llvm::sys::RunSignalHandlers()
/home/su/software/tmp/polly/llvm/lib/Support/Signals.cpp:50:0
#2 0x0000000002028ae2 SignalHandler(int)
/home/su/software/tmp/polly/llvm/lib/Support/Unix/Signals.inc:242:0
#3 0x00007fba44b55390 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x11390)
#4 0x00007fba438c7428 gsignal
/build/glibc-bfm8X4/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0
#5 0x00007fba438c902a abort /build/glibc-bfm8X4/glibc-2.23/stdlib/abort.c:91:0
#6 0x00007fba438bfbd7 __assert_fail_base
/build/glibc-bfm8X4/glibc-2.23/assert/assert.c:92:0
#7 0x00007fba438bfc82 (/lib/x86_64-linux-gnu/libc.so.6+0x2dc82)
#8 0x0000000001b4771d
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/su/software/tmp/polly/llvm/include/llvm/Support/GenericDomTreeConstruction.h:893:0
#9 0x0000000001b50c8d
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock,
false> >::ApplyUpdates(llvm::DominatorTreeBase<llvm::BasicBlock, false>&,
llvm::ArrayRef<llvm::DomTreeBuilder::Update<llvm::BasicBlock*> >)
/home/su/software/tmp/polly/llvm/include/llvm/Support/GenericDomTreeConstruction.h:1149:0
#10 0x0000000001e8388f
std::_Vector_base<llvm::DomTreeBuilder::Update<llvm::BasicBlock*>,
std::allocator<llvm::DomTreeBuilder::Update<llvm::BasicBlock*> >
<span class="quote">>::~_Vector_base() /usr/include/c++/5/bits/stl_vector.h:161:0</span >
#11 0x0000000001e8388f
std::vector<llvm::DomTreeBuilder::Update<llvm::BasicBlock*>,
std::allocator<llvm::DomTreeBuilder::Update<llvm::BasicBlock*> > >::~vector()
/usr/include/c++/5/bits/stl_vector.h:425:0
#12 0x0000000001e8388f llvm::JumpThreadingPass::ProcessBlock(llvm::BasicBlock*)
/home/su/software/tmp/polly/llvm/lib/Transforms/Scalar/JumpThreading.cpp:1043:0
#13 0x0000000001e84319 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/su/software/tmp/polly/llvm/lib/Transforms/Scalar/JumpThreading.cpp:375:0
#14 0x0000000001e85261 std::unique_ptr<llvm::BlockFrequencyInfo,
std::default_delete<llvm::BlockFrequencyInfo> >::~unique_ptr()
/usr/include/c++/5/bits/unique_ptr.h:235:0
#15 0x0000000001e85261 (anonymous
namespace)::JumpThreading::runOnFunction(llvm::Function&) [clone .part.582]
[clone .constprop.597]
/home/su/software/tmp/polly/llvm/lib/Transforms/Scalar/JumpThreading.cpp:296:0
#16 0x0000000001b952fb llvm::FPPassManager::runOnFunction(llvm::Function&)
/home/su/software/tmp/polly/llvm/lib/IR/LegacyPassManager.cpp:1514:0
#17 0x0000000001658b5e RunPassOnSCC
/home/su/software/tmp/polly/llvm/lib/Analysis/CallGraphSCCPass.cpp:156:0
#18 0x0000000001658b5e RunAllPassesOnSCC
/home/su/software/tmp/polly/llvm/lib/Analysis/CallGraphSCCPass.cpp:424:0
#19 0x0000000001658b5e (anonymous
namespace)::CGPassManager::runOnModule(llvm::Module&)
/home/su/software/tmp/polly/llvm/lib/Analysis/CallGraphSCCPass.cpp:479:0
#20 0x0000000001b94efd runOnModule
/home/su/software/tmp/polly/llvm/lib/IR/LegacyPassManager.cpp:1591:0
#21 0x0000000001b94efd llvm::legacy::PassManagerImpl::run(llvm::Module&)
/home/su/software/tmp/polly/llvm/lib/IR/LegacyPassManager.cpp:1694:0
#22 0x00000000021cea2e llvm::PrettyStackTraceString::~PrettyStackTraceString()
/home/su/software/tmp/polly/llvm/include/llvm/Support/PrettyStackTrace.h:52:0
#23 0x00000000021cea2e EmitAssembly
/home/su/software/tmp/polly/llvm/tools/clang/lib/CodeGen/BackendUtil.cpp:788:0
#24 0x00000000021cea2e 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/su/software/tmp/polly/llvm/tools/clang/lib/CodeGen/BackendUtil.cpp:1145:0
#25 0x00000000029c8c97 std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >::~unique_ptr()
/usr/include/c++/5/bits/unique_ptr.h:235:0
#26 0x00000000029c8c97
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
/home/su/software/tmp/polly/llvm/tools/clang/lib/CodeGen/CodeGenAction.cpp:292:0
#27 0x0000000002b9a4b8 void std::swap<bool>(bool&, bool&)
/usr/include/c++/5/bits/move.h:187:0
#28 0x0000000002b9a4b8 clang::ParseAST(clang::Sema&, bool, bool)
/home/su/software/tmp/polly/llvm/tools/clang/lib/Parse/ParseAST.cpp:161:0
#29 0x00000000029c812f clang::CodeGenAction::ExecuteAction()
/home/su/software/tmp/polly/llvm/tools/clang/lib/CodeGen/CodeGenAction.cpp:1024:0
#30 0x0000000002571a56 clang::FrontendAction::Execute()
/home/su/software/tmp/polly/llvm/tools/clang/lib/Frontend/FrontendAction.cpp:897:0
#31 0x0000000002542276
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
/home/su/software/tmp/polly/llvm/tools/clang/lib/Frontend/CompilerInstance.cpp:991:0
#32 0x00000000025ffd62
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
/home/su/software/tmp/polly/llvm/tools/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:252:0
#33 0x0000000000a84488 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*)
/home/su/software/tmp/polly/llvm/tools/clang/tools/driver/cc1_main.cpp:221:0
#34 0x0000000000a01202 ExecuteCC1Tool
/home/su/software/tmp/polly/llvm/tools/clang/tools/driver/driver.cpp:309:0
#35 0x0000000000a01202 main
/home/su/software/tmp/polly/llvm/tools/clang/tools/driver/driver.cpp:388:0
#36 0x00007fba438b2830 __libc_start_main
/build/glibc-bfm8X4/glibc-2.23/csu/../csu/libc-start.c:325:0
#37 0x0000000000a80da9 _start
(/home/su/software/tmp/polly/llvm_build/bin/clang-6.0+0xa80da9)
Stack dump:
0.      Program arguments: /home/su/software/tmp/polly/llvm_build/bin/clang-6.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 -dwarf-column-info -debugger-tuning=gdb
-momit-leaf-frame-pointer -resource-dir
/home/su/software/tmp/polly/llvm_build/lib/clang/6.0.0 -internal-isystem
/usr/local/include -internal-isystem
/home/su/software/tmp/polly/llvm_build/lib/clang/6.0.0/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include -Os
-w -fdebug-compilation-dir
/home/su/specres/20170928-clangpolly-m64-O3-build-205710 -ferror-limit 19
-fmessage-length 201 -fobjc-runtime=gcc -fdiagnostics-show-option
-fcolor-diagnostics -vectorize-loops -vectorize-slp -o /tmp/small-09941c.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 'Jump Threading' on function '@fn3'
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 (<a href="http://llvm.org/git/clang.git">http://llvm.org/git/clang.git</a>
94efed908a60ba04964f220f0822e3463d0dcc38) (<a href="http://llvm.org/git/llvm.git">http://llvm.org/git/llvm.git</a>
8ba98f908f0e471a51ed73bc847bc778af024eab)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/su/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/small-5bc45d.c
clang-6.0: note: diagnostic msg: /tmp/small-5bc45d.sh
clang-6.0: note: diagnostic msg:

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


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


static int a;
int b, c, d, e, f;

int fn1 (int h)

  return h;
}

int fn2 (int h, int j)

  return j ? h / j : h;
}

int fn3 ()

  while (f)
    { 
      int l;
      for (b = 0; b < 4; b++)
        if (!fn1 (l))
          return f;
      if (f - d)
        while (1)
          if (c)
            e = fn2 (a, d);
    }
  return 0;
}

int main ()

  fn3 ();
  return 0;
}</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>