<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Clang crashed because of Assertion `!Substitutions.count(Ptr) && "Substitution already exists!"' failed"
   href="https://bugs.llvm.org/show_bug.cgi?id=48570">48570</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Clang crashed because of Assertion `!Substitutions.count(Ptr) && "Substitution already exists!"' failed
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C++
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>tianshilei1992@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>blitzrakete@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=24309" name="attach_24309" title="it contains device-5f6ac2.cpp and device-5f6ac2.sh">attachment 24309</a> <a href="attachment.cgi?id=24309&action=edit" title="it contains device-5f6ac2.cpp and device-5f6ac2.sh">[details]</a></span>
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 <a href="https://bugs.llvm.org/">https://bugs.llvm.org/</a> 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>
<span class="quote">>, std::__cxx11::basic_string<char, std::char_traits<char>,</span >
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>
<span class="quote">>, std::__cxx11::basic_string<char, std::char_traits<char>,</span >
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 (<a href="mailto:git@github.com">git@github.com</a>: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.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>