[llvm-bugs] [Bug 46136] New: compiler crash when using defaulted spaceship operator and -fcoverage-mapping

via llvm-bugs llvm-bugs at lists.llvm.org
Fri May 29 16:00:04 PDT 2020


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

            Bug ID: 46136
           Summary: compiler crash when using defaulted spaceship operator
                    and -fcoverage-mapping
           Product: clang
           Version: 10.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: adi at thingdust.com
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

I hit the bug in clang 10.0, but it happens on trunk as well:

Godbolt: https://godbolt.org/z/_ueoTg

-std=c++20 -stdlib=libc++ -fprofile-instr-generate -fcoverage-mapping

#include <compare>
#include <string>

struct MyStruct{
    friend bool operator==(MyStruct const& lhs, MyStruct const& rhs) = default;
    friend std::strong_ordering operator<=>(MyStruct const& lhs, MyStruct
const& rhs) = default;

    std::string value;
};

void foo(MyStruct bar){
    (void)(bar <= bar);
}



fatal error: error in backend: File exit not handled before popRegions

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: /opt/compiler-explorer/clang-trunk/bin/clang++ -g -o
./output.s -mllvm --x86-asm-syntax=intel -S
--gcc-toolchain=/opt/compiler-explorer/gcc-9.2.0 -fcolor-diagnostics
-fno-crash-diagnostics -std=c++20 -stdlib=libc++ -Werror
-Wno-zero-as-null-pointer-constant -fprofile-instr-generate -fcoverage-mapping
<source> 

1.      <eof> parser at end of file

2.      Per-file LLVM IR generation

3.      <source>:6:33: Generating code for declaration 'operator<=>'

 #0 0x000055b3b40fc63a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x2bea63a)

 #1 0x000055b3b40fa404 llvm::sys::RunSignalHandlers()
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x2be8404)

 #2 0x000055b3b40fa675 llvm::sys::CleanupOnSignal(unsigned long)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x2be8675)

 #3 0x000055b3b4072662 llvm::CrashRecoveryContext::HandleExit(int)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x2b60662)

 #4 0x000055b3b40f35c7 llvm::sys::Process::Exit(int)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x2be15c7)

 #5 0x000055b3b2348441 LLVMErrorHandler(void*, std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&, bool)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0xe36441)

 #6 0x000055b3b4078ed1 llvm::report_fatal_error(llvm::Twine const&, bool)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x2b66ed1)

 #7 0x000055b3b4079018
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x2b67018)

 #8 0x000055b3b448ef9b (anonymous
namespace)::CounterCoverageMappingBuilder::popRegions(unsigned long)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x2f7cf9b)

 #9 0x000055b3b4494a59 (anonymous
namespace)::CounterCoverageMappingBuilder::propagateCounts(llvm::coverage::Counter,
clang::Stmt const*, bool) (.constprop.507)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x2f82a59)

#10 0x000055b3b4492d9c (anonymous
namespace)::CounterCoverageMappingBuilder::VisitAbstractConditionalOperator(clang::AbstractConditionalOperator
const*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x2f80d9c)

#11 0x000055b3b4492f23 clang::StmtVisitorBase<llvm::make_const_ptr, (anonymous
namespace)::CounterCoverageMappingBuilder, void>::Visit(clang::Stmt const*)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x2f80f23)

#12 0x000055b3b4494592 (anonymous
namespace)::CounterCoverageMappingBuilder::VisitStmt(clang::Stmt const*)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x2f82592)

#13 0x000055b3b4492ebe clang::StmtVisitorBase<llvm::make_const_ptr, (anonymous
namespace)::CounterCoverageMappingBuilder, void>::Visit(clang::Stmt const*)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x2f80ebe)

#14 0x000055b3b4494592 (anonymous
namespace)::CounterCoverageMappingBuilder::VisitStmt(clang::Stmt const*)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x2f82592)

#15 0x000055b3b4492ebe clang::StmtVisitorBase<llvm::make_const_ptr, (anonymous
namespace)::CounterCoverageMappingBuilder, void>::Visit(clang::Stmt const*)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x2f80ebe)

#16 0x000055b3b4494592 (anonymous
namespace)::CounterCoverageMappingBuilder::VisitStmt(clang::Stmt const*)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x2f82592)

#17 0x000055b3b4492ebe clang::StmtVisitorBase<llvm::make_const_ptr, (anonymous
namespace)::CounterCoverageMappingBuilder, void>::Visit(clang::Stmt const*)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x2f80ebe)

#18 0x000055b3b4494592 (anonymous
namespace)::CounterCoverageMappingBuilder::VisitStmt(clang::Stmt const*)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x2f82592)

#19 0x000055b3b4492ebe clang::StmtVisitorBase<llvm::make_const_ptr, (anonymous
namespace)::CounterCoverageMappingBuilder, void>::Visit(clang::Stmt const*)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x2f80ebe)

#20 0x000055b3b4492f79 clang::StmtVisitorBase<llvm::make_const_ptr, (anonymous
namespace)::CounterCoverageMappingBuilder, void>::Visit(clang::Stmt const*)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x2f80f79)

#21 0x000055b3b4494592 (anonymous
namespace)::CounterCoverageMappingBuilder::VisitStmt(clang::Stmt const*)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x2f82592)

#22 0x000055b3b4492ebe clang::StmtVisitorBase<llvm::make_const_ptr, (anonymous
namespace)::CounterCoverageMappingBuilder, void>::Visit(clang::Stmt const*)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x2f80ebe)

#23 0x000055b3b44982fd
clang::CodeGen::CoverageMappingGen::emitCounterMapping(clang::Decl const*,
llvm::raw_ostream&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x2f862fd)

#24 0x000055b3b445c041
clang::CodeGen::CodeGenPGO::emitCounterRegionMapping(clang::Decl const*)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x2f4a041)

#25 0x000055b3b447da7b
clang::CodeGen::CodeGenPGO::assignRegionCounters(clang::GlobalDecl,
llvm::Function*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x2f6ba7b)

#26 0x000055b3b4412a39
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x2f00a39)

#27 0x000055b3b445327a
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl,
llvm::GlobalValue*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x2f4127a)

#28 0x000055b3b44511c5
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl,
llvm::GlobalValue*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x2f3f1c5)

#29 0x000055b3b4457379 clang::CodeGen::CodeGenModule::EmitDeferred()
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x2f45379)

#30 0x000055b3b445745c clang::CodeGen::CodeGenModule::Release()
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x2f4545c)

#31 0x000055b3b4eaf207 (anonymous
namespace)::CodeGeneratorImpl::HandleTranslationUnit(clang::ASTContext&)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x399d207)

#32 0x000055b3b4eaddfd
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x399bdfd)

#33 0x000055b3b5bed509 clang::ParseAST(clang::Sema&, bool, bool)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x46db509)

#34 0x000055b3b48debb9 clang::FrontendAction::Execute()
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x33ccbb9)

#35 0x000055b3b4899d83
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x3387d83)

#36 0x000055b3b49a36eb
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x34916eb)

#37 0x000055b3b23498fc cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0xe378fc)

#38 0x000055b3b234652d ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0xe3452d)

#39 0x000055b3b4774925 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)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x3262925)

#40 0x000055b3b40724f3
llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x2b604f3)

#41 0x000055b3b4775590
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.151)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x3263590)

#42 0x000055b3b474fea5
clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&,
clang::driver::Command const*&) const
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x323dea5)

#43 0x000055b3b47508ef
clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x323e8ef)

#44 0x000055b3b47593f5
clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x32473f5)

#45 0x000055b3b22895f0 main
(/opt/compiler-explorer/clang-trunk/bin/clang+++0xd775f0)

#46 0x00007fa28e700b97 __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x21b97)

#47 0x000055b3b23460aa _start
(/opt/compiler-explorer/clang-trunk/bin/clang+++0xe340aa)

clang-11: error: clang frontend command failed with exit code 70 (use -v to see
invocation)

Compiler returned: 70

-- 
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/20200529/dfd03aed/attachment-0001.html>


More information about the llvm-bugs mailing list