[llvm-bugs] [Bug 33118] New: clang crashes at -Os and above with "-mllvm -enable-newgvn": Assertion `(!ReachableBlocks.count(cast<Instruction>(M)->getParent()) || InstructionsToErase.count(cast<Instruction>(M))) && "Everything in TOP should be unreachable or dead at this " "point"'

via llvm-bugs llvm-bugs at lists.llvm.org
Sun May 21 09:03:31 PDT 2017


https://bugs.llvm.org/show_bug.cgi?id=33118

            Bug ID: 33118
           Summary: clang crashes at -Os and above with "-mllvm
                    -enable-newgvn": Assertion
                    `(!ReachableBlocks.count(cast<Instruction>(M)->getPare
                    nt()) ||
                    InstructionsToErase.count(cast<Instruction>(M))) &&
                    "Everything in TOP should be unreachable or dead at
                    this " "point"'
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: su at cs.ucdavis.edu
                CC: llvm-bugs at lists.llvm.org

It appears to be a recent regression. 


$ clang -v
clang version 5.0.0 (trunk 303495)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/clang-trunk/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
$
$ clang-4.0.0 -Os -mllvm -enable-newgvn -c small.c
$ clang -Os -c small.c
$
$ clang -Os -mllvm -enable-newgvn -c small.c
clang-5.0:
/tmp/llvm-builder/llvm-source-trunk/lib/Transforms/Scalar/NewGVN.cpp:3575: bool
{anonymous}::NewGVN::eliminateInstructions(llvm::Function&): Assertion
`(!ReachableBlocks.count(cast<Instruction>(M)->getParent()) ||
InstructionsToErase.count(cast<Instruction>(M))) && "Everything in TOP should
be unreachable or dead at this " "point"' failed.
#0 0x000000000221f3da llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/clang-trunk/bin/clang-5.0+0x221f3da)
#1 0x000000000221d15e llvm::sys::RunSignalHandlers()
(/usr/local/clang-trunk/bin/clang-5.0+0x221d15e)
#2 0x000000000221d2d2 SignalHandler(int)
(/usr/local/clang-trunk/bin/clang-5.0+0x221d2d2)
#3 0x00007fa8b2a9b390 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x11390)
#4 0x00007fa8b180e428 gsignal
/build/glibc-9tT8Do/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0
#5 0x00007fa8b181002a abort /build/glibc-9tT8Do/glibc-2.23/stdlib/abort.c:91:0
#6 0x00007fa8b1806bd7 __assert_fail_base
/build/glibc-9tT8Do/glibc-2.23/assert/assert.c:92:0
#7 0x00007fa8b1806c82 (/lib/x86_64-linux-gnu/libc.so.6+0x2dc82)
#8 0x0000000002115556 (anonymous
namespace)::NewGVN::eliminateInstructions(llvm::Function&)
(/usr/local/clang-trunk/bin/clang-5.0+0x2115556)
#9 0x0000000002119d58 (anonymous namespace)::NewGVN::runGVN() [clone
.constprop.1270] (/usr/local/clang-trunk/bin/clang-5.0+0x2119d58)
#10 0x000000000211b1b7 NewGVNLegacyPass::runOnFunction(llvm::Function&) [clone
.part.1264] [clone .constprop.1268]
(/usr/local/clang-trunk/bin/clang-5.0+0x211b1b7)
#11 0x0000000001d79f03 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/usr/local/clang-trunk/bin/clang-5.0+0x1d79f03)
#12 0x0000000002c177fe (anonymous
namespace)::CGPassManager::runOnModule(llvm::Module&)
(/usr/local/clang-trunk/bin/clang-5.0+0x2c177fe)
#13 0x0000000001d79a6d llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/usr/local/clang-trunk/bin/clang-5.0+0x1d79a6d)
#14 0x00000000023ce619 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+0x23ce619)
#15 0x0000000002aa8359
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/usr/local/clang-trunk/bin/clang-5.0+0x2aa8359)
#16 0x0000000002e6a0f8 clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/clang-trunk/bin/clang-5.0+0x2e6a0f8)
#17 0x0000000002aa76ef clang::CodeGenAction::ExecuteAction()
(/usr/local/clang-trunk/bin/clang-5.0+0x2aa76ef)
#18 0x0000000002768356 clang::FrontendAction::Execute()
(/usr/local/clang-trunk/bin/clang-5.0+0x2768356)
#19 0x000000000273a176
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/clang-trunk/bin/clang-5.0+0x273a176)
#20 0x00000000027f3f9a
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/clang-trunk/bin/clang-5.0+0x27f3f9a)
#21 0x0000000000c9b748 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/local/clang-trunk/bin/clang-5.0+0xc9b748)
#22 0x0000000000c2ea60 main (/usr/local/clang-trunk/bin/clang-5.0+0xc2ea60)
#23 0x00007fa8b17f9830 __libc_start_main
/build/glibc-9tT8Do/glibc-2.23/csu/../csu/libc-start.c:325:0
#24 0x0000000000c97e09 _start (/usr/local/clang-trunk/bin/clang-5.0+0xc97e09)
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
-coverage-notes-file /home/su/small.gcno -resource-dir
/usr/local/clang-trunk/lib/clang/5.0.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 -Os
-fdebug-compilation-dir /home/su -ferror-limit 19 -fmessage-length 120
-fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics
-vectorize-loops -vectorize-slp -mllvm -enable-newgvn -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 'Global Value Numbering' on function '@f'
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 303495)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/clang-trunk/bin
clang-5.0: note: diagnostic msg: PLEASE submit a bug report to
http://llvm.org/bugs/ 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-5c9e34.c
clang-5.0: note: diagnostic msg: /tmp/small-5c9e34.sh
clang-5.0: note: diagnostic msg:

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


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


int a;

void f ()
{ 
  int c;
  while (a)
    for (; c < 1; c++)
      while (a)
        ;
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170521/5dbdf0f6/attachment.html>


More information about the llvm-bugs mailing list