[llvm-bugs] [Bug 48570] New: Clang crashed because of Assertion `!Substitutions.count(Ptr) && "Substitution already exists!"' failed

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Dec 21 13:45:49 PST 2020


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

            Bug ID: 48570
           Summary: Clang crashed because of Assertion
                    `!Substitutions.count(Ptr) && "Substitution already
                    exists!"' failed
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: tianshilei1992 at gmail.com
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

Created attachment 24309
  --> https://bugs.llvm.org/attachment.cgi?id=24309&action=edit
it contains device-5f6ac2.cpp and device-5f6ac2.sh

This bug blocks building `libomptarget`. Here is the stack dump:
```
clang++:
/home/shiltian/Documents/vscode/llvm-project/clang/lib/AST/ItaniumMangle.cpp:5798:
void {anonymous}::CXXNameMangler::addSubstitution(uintptr_t): Assertion
`!Substitutions.count(Ptr) && "Substitution already exists!"' 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: clang++
-I/home/shiltian/Documents/vscode/llvm-project/openmp/libomptarget/include
-std=gnu++14 -o device.cpp.o -c
/home/shiltian/Documents/vscode/llvm-project/openmp/libomptarget/src/device.cpp
1.     
/home/shiltian/Documents/vscode/llvm-project/openmp/libomptarget/src/device.cpp:97:1:
current parser token 'int'
2.     
/home/shiltian/Documents/vscode/llvm-project/openmp/libomptarget/src/device.cpp:58:15:
LLVM IR generation of declaration 'DeviceTy::associatePtr'
3.     
/home/shiltian/Documents/vscode/llvm-project/openmp/libomptarget/src/device.cpp:58:15:
Generating code for declaration 'DeviceTy::associatePtr'
4.     
/usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/bits/stl_set.h:804:2:
Mangling declaration 'std::set<HostDataToTargetTy, std::less<>>::find'
 #0 0x0000000001d72a1d llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x1d72a1d)
 #1 0x0000000001d70894 llvm::sys::RunSignalHandlers()
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x1d70894)
 #2 0x0000000001ce7d08 CrashRecoverySignalHandler(int)
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x1ce7d08)
 #3 0x00007fca939ffa90 __restore_rt (/lib64/libpthread.so.0+0x14a90)
 #4 0x00007fca934af9e5 raise (/lib64/libc.so.6+0x3c9e5)
 #5 0x00007fca93498895 abort (/lib64/libc.so.6+0x25895)
 #6 0x00007fca93498769 _nl_load_domain.cold (/lib64/libc.so.6+0x25769)
 #7 0x00007fca934a7e76 (/lib64/libc.so.6+0x34e76)
 #8 0x00000000044be9a7 (anonymous
namespace)::CXXNameMangler::addSubstitution(unsigned long)
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x44be9a7)
 #9 0x00000000044c43b3 (anonymous
namespace)::CXXNameMangler::mangleBareFunctionType(clang::FunctionProtoType
const*, bool, clang::FunctionDecl const*)
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x44c43b3)
#10 0x00000000044ca444 (anonymous
namespace)::CXXNameMangler::mangleFunctionEncoding(clang::GlobalDecl)
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x44ca444)
#11 0x00000000044ccc12 (anonymous
namespace)::ItaniumMangleContextImpl::mangleCXXName(clang::GlobalDecl,
llvm::raw_ostream&)
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x44ccc12)
#12 0x00000000020fce3c getMangledNameImpl(clang::CodeGen::CodeGenModule const&,
clang::GlobalDecl, clang::NamedDecl const*, bool)
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x20fce3c)
#13 0x000000000210a326
clang::CodeGen::CodeGenModule::getMangledName(clang::GlobalDecl)
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x210a326)
#14 0x00000000021223cf
clang::CodeGen::CodeGenModule::GetAddrOfFunction(clang::GlobalDecl,
llvm::Type*, bool, bool, clang::CodeGen::ForDefinition_t)
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x21223cf)
#15 0x0000000002355133
clang::CodeGen::CodeGenFunction::EmitCXXMemberOrOperatorMemberCallExpr(clang::CallExpr
const*, clang::CXXMethodDecl const*, clang::CodeGen::ReturnValueSlot, bool,
clang::NestedNameSpecifier*, bool, clang::Expr const*)
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x2355133)
#16 0x0000000002355676
clang::CodeGen::CodeGenFunction::EmitCXXMemberCallExpr(clang::CXXMemberCallExpr
const*, clang::CodeGen::ReturnValueSlot)
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x2355676)
#17 0x000000000234451f (anonymous
namespace)::AggExprEmitter::withReturnValueSlot(clang::Expr const*,
llvm::function_ref<clang::CodeGen::RValue (clang::CodeGen::ReturnValueSlot)>)
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x234451f)
#18 0x0000000002344ab5 (anonymous
namespace)::AggExprEmitter::VisitCallExpr(clang::CallExpr const*)
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x2344ab5)
#19 0x0000000002345bba clang::StmtVisitorBase<std::add_pointer, (anonymous
namespace)::AggExprEmitter, void>::Visit(clang::Stmt*)
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x2345bba)
#20 0x0000000002346c78 clang::CodeGen::CodeGenFunction::EmitAggExpr(clang::Expr
const*, clang::CodeGen::AggValueSlot)
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x2346c78)
#21 0x000000000234034b (anonymous
namespace)::AggExprEmitter::VisitCXXConstructExpr(clang::CXXConstructExpr
const*) (/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x234034b)
#22 0x00000000023465b2 clang::StmtVisitorBase<std::add_pointer, (anonymous
namespace)::AggExprEmitter, void>::Visit(clang::Stmt*)
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x23465b2)
#23 0x0000000002346c78 clang::CodeGen::CodeGenFunction::EmitAggExpr(clang::Expr
const*, clang::CodeGen::AggValueSlot)
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x2346c78)
#24 0x00000000022f6426
clang::CodeGen::CodeGenFunction::EmitExprAsInit(clang::Expr const*,
clang::ValueDecl const*, clang::CodeGen::LValue, bool)
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x22f6426)
#25 0x00000000022fd2eb
clang::CodeGen::CodeGenFunction::EmitAutoVarInit(clang::CodeGen::CodeGenFunction::AutoVarEmission
const&) (/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x22fd2eb)
#26 0x0000000002301306
clang::CodeGen::CodeGenFunction::EmitAutoVarDecl(clang::VarDecl const&)
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x2301306)
#27 0x0000000002301675 clang::CodeGen::CodeGenFunction::EmitDecl(clang::Decl
const&) (.localalias)
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x2301675)
#28 0x000000000206dc3f
clang::CodeGen::CodeGenFunction::EmitDeclStmt(clang::DeclStmt const&)
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x206dc3f)
#29 0x000000000207e9d5
clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*,
llvm::ArrayRef<clang::Attr const*>)
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x207e9d5)
#30 0x0000000002078b94 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt
const*, llvm::ArrayRef<clang::Attr const*>)
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x2078b94)
#31 0x0000000002079614
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt
const&, bool, clang::CodeGen::AggValueSlot)
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x2079614)
#32 0x00000000020d045e
clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*)
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x20d045e)
#33 0x00000000020ddc6a
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&)
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x20ddc6a)
#34 0x000000000212282c
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl,
llvm::GlobalValue*)
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x212282c)
#35 0x000000000211f4ad
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl,
llvm::GlobalValue*)
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x211f4ad)
#36 0x000000000212726a
clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) (.part.0)
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x212726a)
#37 0x0000000002ce1d81 (anonymous
namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef)
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x2ce1d81)
#38 0x0000000002cd6ca3
clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef)
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x2cd6ca3)
#39 0x0000000003723774 clang::ParseAST(clang::Sema&, bool, bool)
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x3723774)
#40 0x0000000002656969 clang::FrontendAction::Execute()
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x2656969)
#41 0x0000000002601806
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x2601806)
#42 0x0000000002709c1b
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x2709c1b)
#43 0x000000000094cdee cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x94cdee)
#44 0x0000000000948cbd ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x948cbd)
#45 0x00000000024bf725 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)
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x24bf725)
#46 0x0000000001ce7e74
llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>)
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x1ce7e74)
#47 0x00000000024c05f8
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.0)
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x24c05f8)
#48 0x00000000024950d2
clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&,
clang::driver::Command const*&) const
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x24950d2)
#49 0x00000000024957a7
clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x24957a7)
#50 0x00000000024a0281
clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&)
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x24a0281)
#51 0x00000000008b6318 main
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x8b6318)
#52 0x00007fca9349a042 __libc_start_main (/lib64/libc.so.6+0x27042)
#53 0x00000000009481ee _start
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x9481ee)
#53 0x00000000009481ee _start
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x9481ee)
clang-12: error: clang frontend command failed with exit code 134 (use -v to
see invocation)
clang version 12.0.0 (git at github.com:tianshilei1992/llvm-project.git
bd2e83333ece6afa8a6c1975d19d403d63349414)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/shiltian/Documents/deploy/llvm/release/bin
clang-12: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-12: note: diagnostic msg: /tmp/device-5f6ac2.cpp
clang-12: note: diagnostic msg: /tmp/device-5f6ac2.sh
clang-12: note: diagnostic msg:

********************
```

System information:
➜ lsb_release -a
LSB Version:   
:core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch
Distributor ID: Fedora
Description:    Fedora release 32 (Thirty Two)
Release:        32
Codename:       ThirtyTwo
➜ gcc --version
gcc (GCC) 10.2.1 20201125 (Red Hat 10.2.1-9)
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

-- 
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/20201221/bacb782e/attachment-0001.html>


More information about the llvm-bugs mailing list