llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
27.8k stars 11.45k forks source link

Crash when compiling #37935

Open llvmbot opened 6 years ago

llvmbot commented 6 years ago
Bugzilla Link 38587
Version unspecified
OS Linux
Attachments backtrace, .sh file, .sh, backtrack, and .cpp file, compressed
Reporter LLVM Bugzilla Contributor

Extended Description

Backtrace attached. Will attach .cpp an .sh file in next comment.

llvmbot commented 6 years ago

I figured out that the comparator had a default contructor that was implicitly deleted by a const OBJ cont* object, but I was able to specify that the default contructor = default, which was weird that it didn't complain. This was all in header files. When I moved the implementation of the 'offending' constructor to the .cc file then it failed correctly before crashing.

Endilll commented 1 year ago

Still crashing as of post-17 trunk: https://godbolt.org/z/ze6ovGcq4 Reduced by me and C-Reduce:

template <class KeyCompare>
struct flat_tree {
  flat_tree();
  KeyCompare impl_;
};

template <class KeyCompare>
flat_tree<KeyCompare>::flat_tree() = default;

struct RangeLessThan {
  RangeLessThan(int);
};

flat_tree<RangeLessThan> empty_ranges_;
llvmbot commented 1 year ago

@llvm/issue-subscribers-c-1

llvmbot commented 1 year ago

@llvm/issue-subscribers-clang-frontend

shafik commented 1 year ago

Assertion:

clang++: /root/llvm-project/clang/lib/Sema/SemaDeclCXX.cpp:13835:
void clang::Sema::DefineImplicitDefaultConstructor(clang::SourceLocation, clang::CXXConstructorDecl*):
Assertion `(Constructor->isDefaulted() && Constructor->isDefaultConstructor() && !Constructor->doesThisDeclarationHaveABody() && !Constructor->isDeleted()) && "DefineImplicitDefaultConstructor - call it for implicit default ctor"' failed.

Backtrace:

PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.  Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/clang++ -gdwarf-4 -g -o /app/output.s -mllvm --x86-asm-syntax=intel -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics <source>
1.  <eof> parser at end of file
2.  <source>:3:3: instantiating function definition 'flat_tree<RangeLessThan>::flat_tree'
 #0 0x00000000036bb0e8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x36bb0e8)
 #1 0x00000000036b8dac llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x36b8dac)
 #2 0x00000000036021c8 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x00007efd9b650420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #4 0x00007efd9b11300b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
 #5 0x00007efd9b0f2859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
 #6 0x00007efd9b0f2729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729)
 #7 0x00007efd9b103fd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
 #8 0x00000000062a3f79 clang::Sema::DefineImplicitDefaultConstructor(clang::SourceLocation, clang::CXXConstructorDecl*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x62a3f79)
 #9 0x00000000062a6042 clang::Sema::SetDeclDefaulted(clang::Decl*, clang::SourceLocation) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x62a6042)
#10 0x00000000069b138c clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation, clang::FunctionDecl*, bool, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x69b138c)
#11 0x00000000069afccf clang::Sema::PerformPendingInstantiations(bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x69afccf)
#12 0x0000000005f89909 clang::Sema::ActOnEndOfTranslationUnitFragment(clang::Sema::TUFragmentKind) (.part.0) Sema.cpp:0:0
#13 0x0000000005f8a0e2 clang::Sema::ActOnEndOfTranslationUnit() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5f8a0e2)
#14 0x0000000005e1fa03 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5e1fa03)
#15 0x0000000005e13bda clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5e13bda)
#16 0x000000000491c718 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x491c718)
#17 0x000000000417a659 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x417a659)
#18 0x00000000040fcfae clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x40fcfae)
#19 0x000000000425ab76 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x425ab76)
#20 0x0000000000bd3e2e cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xbd3e2e)
#21 0x0000000000bcc4ea ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#22 0x0000000003f5de29 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::'lambda'()>(long) Job.cpp:0:0
#23 0x0000000003602674 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3602674)
#24 0x0000000003f5e41f clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (.part.0) Job.cpp:0:0
#25 0x0000000003f267a5 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3f267a5)
#26 0x0000000003f2720d clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3f2720d)
#27 0x0000000003f2f135 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3f2f135)
#28 0x0000000000bd20cc clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xbd20cc)
#29 0x0000000000ace021 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xace021)
#30 0x00007efd9b0f4083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#31 0x0000000000bcbfce _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xbcbfce)
clang++: error: clang frontend command failed with exit code 134 (use -v to see invocation)
Compiler returned: 134