[llvm-bugs] [Bug 50441] New: clang crashes on valid code at -O1 and above when enabling -g on x86_64-linux-gnu: Assertion `getParent() && "Not embedded in a basic block!"' failed
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri May 21 23:51:34 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=50441
Bug ID: 50441
Summary: clang crashes on valid code at -O1 and above when
enabling -g on x86_64-linux-gnu: Assertion
`getParent() && "Not embedded in a basic block!"'
failed
Product: libraries
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: Common Code Generator Code
Assignee: unassignedbugs at nondot.org
Reporter: zhendong.su at inf.ethz.ch
CC: llvm-bugs at lists.llvm.org
[523] % clangtk -v
clang version 13.0.0 (https://github.com/llvm/llvm-project.git
86008477a4eb9ecac27f469539c4ac5e0fce44dc)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /local/suz-local/opfuzz/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.5.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.5.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.5.0
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
[524] %
[524] % clangtk -O1 -c small.c
[525] %
[525] % clangtk -O1 -g -c small.c
clangtk:
/local/suz-local/software/clangbuild/llvm-project/llvm/lib/CodeGen/MachineInstr.cpp:678:
void llvm::MachineInstr::eraseFromParent(): Assertion `getParent() && "Not
embedded in a basic block!"' failed.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash
backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: clangtk -O1 -g -c small.c
1. <eof> parser at end of file
2. Code generation
3. Running pass 'Function Pass Manager' on module 'small.c'.
4. Running pass 'Early Tail Duplication' on function '@main'
#0 0x0000556c746901bc llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x37531bc)
#1 0x0000556c7468e074 llvm::sys::RunSignalHandlers()
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x3751074)
#2 0x0000556c7468e2f5 llvm::sys::CleanupOnSignal(unsigned long)
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x37512f5)
#3 0x0000556c745e8ac8 CrashRecoverySignalHandler(int)
CrashRecoveryContext.cpp:0:0
#4 0x00007f051b8e6980 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12980)
#5 0x00007f051a597fb7 raise
/build/glibc-S9d2JN/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
#6 0x00007f051a599921 abort /build/glibc-S9d2JN/glibc-2.27/stdlib/abort.c:81:0
#7 0x00007f051a58948a __assert_fail_base
/build/glibc-S9d2JN/glibc-2.27/assert/assert.c:89:0
#8 0x00007f051a589502 (/lib/x86_64-linux-gnu/libc.so.6+0x30502)
#9 0x0000556c73a16f4a
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x2ad9f4a)
#10 0x0000556c73bddfd5 llvm::TailDuplicator::tailDuplicateAndUpdate(bool,
llvm::MachineBasicBlock*, llvm::MachineBasicBlock*,
llvm::SmallVectorImpl<llvm::MachineBasicBlock*>*, llvm::function_ref<void
(llvm::MachineBasicBlock*)>*, llvm::SmallVectorImpl<llvm::MachineBasicBlock*>*)
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x2ca0fd5)
#11 0x0000556c73bde807 llvm::TailDuplicator::tailDuplicateBlocks()
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x2ca1807)
#12 0x0000556c73bd463a (anonymous
namespace)::TailDuplicateBase::runOnMachineFunction(llvm::MachineFunction&)
TailDuplication.cpp:0:0
#13 0x0000556c73a0fe36
llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x2ad2e36)
#14 0x0000556c73e87648 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x2f4a648)
#15 0x0000556c73e88179 llvm::FPPassManager::runOnModule(llvm::Module&)
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x2f4b179)
#16 0x0000556c73e86ec6 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x2f49ec6)
#17 0x0000556c74966585 (anonymous
namespace)::EmitAssemblyHelper::EmitAssemblyWithNewPassManager(clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >) BackendUtil.cpp:0:0
#18 0x0000556c74969dd3 clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::HeaderSearchOptions const&, clang::CodeGenOptions const&,
clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef,
llvm::Module*, clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x3a2cdd3)
#19 0x0000556c756012ea
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x46c42ea)
#20 0x0000556c76463eb9 clang::ParseAST(clang::Sema&, bool, bool)
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x5526eb9)
#21 0x0000556c75601488 clang::CodeGenAction::ExecuteAction()
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x46c4488)
#22 0x0000556c74f80251 clang::FrontendAction::Execute()
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x4043251)
#23 0x0000556c74f1be22
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x3fdee22)
#24 0x0000556c7504b82a
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x410e82a)
#25 0x0000556c722eb26c cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/local/suz-local/software/local/clang-trunk/bin/clang-13+0x13ae26c)
#26 0x0000556c722e6609 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
driver.cpp:0:0
#27 0x0000556c74dd3215 void llvm::function_ref<void
()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
>, std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >*, bool*) const::'lambda'()>(long) Job.cpp:0:0
#28 0x0000556c745e8ba3
llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>)
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x36abba3)
#29 0x0000556c74dd3bb4
clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
>, std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >*, bool*) const (.part.161) Job.cpp:0:0
#30 0x0000556c74dabeaa
clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&,
clang::driver::Command const*&) const
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x3e6eeaa)
#31 0x0000556c74dacb4f
clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x3e6fb4f)
#32 0x0000556c74db531a
clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&)
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x3e7831a)
#33 0x0000556c722144e5 main
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x12d74e5)
#34 0x00007f051a57abf7 __libc_start_main
/build/glibc-S9d2JN/glibc-2.27/csu/../csu/libc-start.c:344:0
#35 0x0000556c722e617a _start
(/local/suz-local/software/local/clang-trunk/bin/clang-13+0x13a917a)
clang-13: error: clang frontend command failed with exit code 134 (use -v to
see invocation)
clang version 13.0.0 (https://github.com/llvm/llvm-project.git
86008477a4eb9ecac27f469539c4ac5e0fce44dc)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /local/suz-local/opfuzz/bin
clang-13: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-13: note: diagnostic msg: /tmp/small-300c31.c
clang-13: note: diagnostic msg: /tmp/small-300c31.sh
clang-13: note: diagnostic msg:
********************
[526] %
[526] % cat small.c
extern void h(void);
int a, b, c, d;
int main() {
int f = 1;
for (; d; d++)
;
L:
if (a)
h();
if (b) {
h();
goto L;
}
int i = 1 & f, j = f | i, k = f;
f = 0;
if (k < c) {
h();
goto L;
}
}
--
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/20210522/49b29efe/attachment.html>
More information about the llvm-bugs
mailing list