<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 - AST: ItaniumMangle: CXXNameMangler::addSubstitution produce error"
   href="https://bugs.llvm.org/show_bug.cgi?id=33080">33080</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>AST: ItaniumMangle: CXXNameMangler::addSubstitution produce error
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>4.0
          </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>enhancement
          </td>
        </tr>

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

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

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

        <tr>
          <th>Reporter</th>
          <td>yume-wikijp@live.jp
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I was tried to compile 
<a href="https://github.com/Microsoft/ChakraCore/tree/357fe4c954d776a2d40c6a9ac65931ec31585f46">https://github.com/Microsoft/ChakraCore/tree/357fe4c954d776a2d40c6a9ac65931ec31585f46</a>

However, Build was aborted.

$ ./build.sh --cxx=/usr/local/bin/clang++-4.0 --cc=/usr/local/bin/clang-4.0
--valgrind --lto-thin -j=1 -n
lto: ranlib disabled
Custom CXX /usr/local/bin/clang++-4.0
Custom CC  /usr/local/bin/clang-4.0
Build path: ./out/Release
-- ./bin/ch/DbgController.js.h is up to date. skipping.
Compile Target : System Default
Generating Release makefiles
-- Configuring done
-- Generating done
-- Build files have been written to:
/home/yumetodo/ドキュメント/ChakraCore/out/Release
[1/309] Building CXX object
lib/Runtime/ByteCode/CMakeFiles/Chakra.Runtime.ByteCode.dir/ByteCodeSerializer.cpp.o
FAILED: /usr/local/bin/clang++-4.0   -DBIT64=1 -DCAN_BUILD_WABT
-DCLANG_HAS_DISABLE_TAIL_CALLS=1 -DENABLE_VALGRIND=1 -DFEATURE_PAL
-DHAS_REAL_ICU=1 -DLINUX64 -DNO_PAL_MINMAX -DPAL_STDCPP_COMPAT
-DPLATFORM_UNIX=1 -DSTACK_ALIGN=16 -DUNICODE -D_AMD64_ -D_M_AMD64 -D_M_X64
-D_M_X64_OR_ARM64 -D_SAFECRT_USE_CPP_OVERLOADS=1 -D__LINUX__=1
-D__STDC_WANT_LIB_EXT1__=1 -I../../. -I../../lib/Common
-I../../lib/Common/PlaceHolder -I../../pal -I../../pal/inc -I../../pal/inc/rt
-I../../lib/Runtime/. -I../../lib/Runtime/../JITIDL
-I../../lib/Runtime/../Common -I../../lib/Runtime/../Backend
-I../../lib/Runtime/../Parser -I../../lib/Runtime/../WasmReader
-I../../lib/Runtime/ByteCode -I../../lib/Runtime/PlatformAgnostic
-I../../lib/Runtime/Math -Werror         -Wno-ignored-attributes       
-Wno-deprecated-declarations        -Wno-parentheses-equality       
-Wno-missing-braces        -Wno-reorder        -Wno-microsoft       
-Wno-unused-value        -Wno-int-to-void-pointer-cast       
-Wno-invalid-offsetof        -Wno-undefined-inline       
-Wno-inconsistent-missing-override        -Wno-c++14-extensions       
-Wno-macro-redefined        -Wno-pragmas        -Wno-invalid-token-paste       
-Wno-format        -Wno-invalid-noreturn        -Wno-null-arithmetic       
-Wno-tautological-constant-out-of-range-compare       
-Wno-tautological-undefined-compare        -Wno-address-of-temporary       
-Wno-null-conversion        -Wno-return-type        -Wno-switch       
-Wno-implicit-function-declaration        -Wno-int-to-pointer-cast             
    -fno-omit-frame-pointer         -fdelayed-template-parsing -O3 -DNDEBUG  
-fdiagnostics-color=always -msse4.2 -fasm-blocks -fms-extensions -fwrapv
-flto=thin -O3 -fPIC -std=gnu++11 -MMD -MT
lib/Runtime/ByteCode/CMakeFiles/Chakra.Runtime.ByteCode.dir/ByteCodeSerializer.cpp.o
-MF
lib/Runtime/ByteCode/CMakeFiles/Chakra.Runtime.ByteCode.dir/ByteCodeSerializer.cpp.o.d
-o
lib/Runtime/ByteCode/CMakeFiles/Chakra.Runtime.ByteCode.dir/ByteCodeSerializer.cpp.o
-c ../../lib/Runtime/ByteCode/ByteCodeSerializer.cpp
clang-4.0:
/home/yumetodo/clang_build/llvm/tools/clang/lib/AST/ItaniumMangle.cpp:4496:
void {anonymous}::CXXNameMangler::addSubstitution(uintptr_t): Assertion
`!Substitutions.count(Ptr) && "Substitution already exists!"' failed.
#0 0x0000000001f6c148 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/llvm-4.0.0/bin/clang-4.0+0x1f6c148)
#1 0x0000000001f69b5e llvm::sys::RunSignalHandlers()
(/usr/local/llvm-4.0.0/bin/clang-4.0+0x1f69b5e)
#2 0x0000000001f69f62 SignalHandler(int)
(/usr/local/llvm-4.0.0/bin/clang-4.0+0x1f69f62)
#3 0x00007f57ac83d390 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x11390)
#4 0x00007f57ab5b0428 gsignal
/build/glibc-9tT8Do/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0
#5 0x00007f57ab5b202a abort /build/glibc-9tT8Do/glibc-2.23/stdlib/abort.c:91:0
#6 0x00007f57ab5a8bd7 __assert_fail_base
/build/glibc-9tT8Do/glibc-2.23/assert/assert.c:92:0
#7 0x00007f57ab5a8c82 (/lib/x86_64-linux-gnu/libc.so.6+0x2dc82)
#8 0x00000000037e5070 (anonymous
namespace)::CXXNameMangler::addSubstitution(unsigned long)
(/usr/local/llvm-4.0.0/bin/clang-4.0+0x37e5070)
#9 0x00000000037ed239 (anonymous
namespace)::CXXNameMangler::mangleType(clang::QualType)
(/usr/local/llvm-4.0.0/bin/clang-4.0+0x37ed239)
#10 0x00000000037efb3d (anonymous
namespace)::CXXNameMangler::mangleTemplateArg(clang::TemplateArgument)
(/usr/local/llvm-4.0.0/bin/clang-4.0+0x37efb3d)
#11 0x00000000037effe9 (anonymous
namespace)::CXXNameMangler::mangleTemplateArgs(clang::TemplateArgumentList
const&) (/usr/local/llvm-4.0.0/bin/clang-4.0+0x37effe9)
#12 0x00000000037f01ab (anonymous
namespace)::CXXNameMangler::manglePrefix(clang::DeclContext const*, bool)
(/usr/local/llvm-4.0.0/bin/clang-4.0+0x37f01ab)
#13 0x00000000037f089f (anonymous
namespace)::CXXNameMangler::mangleNestedName(clang::NamedDecl const*,
clang::DeclContext const*, llvm::SmallVector<llvm::StringRef, 4u> const*, bool)
(/usr/local/llvm-4.0.0/bin/clang-4.0+0x37f089f)
#14 0x00000000037e8a67 (anonymous
namespace)::CXXNameMangler::mangleNameWithAbiTags(clang::NamedDecl const*,
llvm::SmallVector<llvm::StringRef, 4u> const*)
(/usr/local/llvm-4.0.0/bin/clang-4.0+0x37e8a67)
#15 0x00000000037e67d5 (anonymous
namespace)::CXXNameMangler::mangleName(clang::NamedDecl const*)
(/usr/local/llvm-4.0.0/bin/clang-4.0+0x37e67d5)
#16 0x00000000037e8bc1 (anonymous
namespace)::CXXNameMangler::mangleFunctionEncoding(clang::FunctionDecl const*)
(/usr/local/llvm-4.0.0/bin/clang-4.0+0x37e8bc1)
#17 0x00000000037ea234 (anonymous
namespace)::ItaniumMangleContextImpl::mangleCXXDtor(clang::CXXDestructorDecl
const*, clang::CXXDtorType, llvm::raw_ostream&)
(/usr/local/llvm-4.0.0/bin/clang-4.0+0x37ea234)
#18 0x00000000021a45a9
clang::CodeGen::CodeGenModule::getMangledName(clang::GlobalDecl)
(/usr/local/llvm-4.0.0/bin/clang-4.0+0x21a45a9)
#19 0x00000000021bf1cc
clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl)
(/usr/local/llvm-4.0.0/bin/clang-4.0+0x21bf1cc)
#20 0x00000000021f0065 (anonymous
namespace)::ItaniumCXXABI::EmitCXXConstructors(clang::CXXConstructorDecl
const*) (/usr/local/llvm-4.0.0/bin/clang-4.0+0x21f0065)
#21 0x00000000021bf924
clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*)
(/usr/local/llvm-4.0.0/bin/clang-4.0+0x21bf924)
#22 0x00000000027e58c7 (anonymous
namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef)
(/usr/local/llvm-4.0.0/bin/clang-4.0+0x27e58c7)
#23 0x00000000027dc943
clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef)
(/usr/local/llvm-4.0.0/bin/clang-4.0+0x27dc943)
#24 0x0000000003278a35
clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation,
clang::FunctionDecl*, bool, bool, bool)
(/usr/local/llvm-4.0.0/bin/clang-4.0+0x3278a35)
#25 0x00000000032778fc clang::Sema::PerformPendingInstantiations(bool)
(/usr/local/llvm-4.0.0/bin/clang-4.0+0x32778fc)
#26 0x0000000002e0973c clang::Sema::ActOnEndOfTranslationUnit()
(/usr/local/llvm-4.0.0/bin/clang-4.0+0x2e0973c)
#27 0x0000000002bf6696
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
(/usr/local/llvm-4.0.0/bin/clang-4.0+0x2bf6696)
#28 0x0000000002bed29b clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/llvm-4.0.0/bin/clang-4.0+0x2bed29b)
#29 0x00000000027dd868 clang::CodeGenAction::ExecuteAction()
(/usr/local/llvm-4.0.0/bin/clang-4.0+0x27dd868)
#30 0x00000000024a5d46 clang::FrontendAction::Execute()
(/usr/local/llvm-4.0.0/bin/clang-4.0+0x24a5d46)
#31 0x000000000247269e
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/llvm-4.0.0/bin/clang-4.0+0x247269e)
#32 0x0000000002533f1d
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/llvm-4.0.0/bin/clang-4.0+0x2533f1d)
#33 0x0000000000af4b28 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/local/llvm-4.0.0/bin/clang-4.0+0xaf4b28)
#34 0x0000000000a7d34d main (/usr/local/llvm-4.0.0/bin/clang-4.0+0xa7d34d)
#35 0x00007f57ab59b830 __libc_start_main
/build/glibc-9tT8Do/glibc-2.23/csu/../csu/libc-start.c:325:0
#36 0x0000000000af0df9 _start (/usr/local/llvm-4.0.0/bin/clang-4.0+0xaf0df9)
Stack dump:
0.      Program arguments: /usr/local/llvm-4.0.0/bin/clang-4.0 -cc1 -triple
x86_64-unknown-linux-gnu -emit-llvm-bc -flto=thin -disable-free -main-file-name
ByteCodeSerializer.cpp -mrelocation-model pic -pic-level 2 -mthread-model posix
-mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases
-munwind-tables -fuse-init-array -target-cpu x86-64 -target-feature +sse4.2
-momit-leaf-frame-pointer -dwarf-column-info -debugger-tuning=gdb
-coverage-notes-file
/home/yumetodo/ドキュメント/ChakraCore/out/Release/lib/Runtime/ByteCode/CMakeFiles/Chakra.Runtime.ByteCode.dir/ByteCodeSerializer.cpp.gcno
-resource-dir /usr/local/llvm-4.0.0/bin/../lib/clang/4.0.0 -dependency-file
lib/Runtime/ByteCode/CMakeFiles/Chakra.Runtime.ByteCode.dir/ByteCodeSerializer.cpp.o.d
-MT
lib/Runtime/ByteCode/CMakeFiles/Chakra.Runtime.ByteCode.dir/ByteCodeSerializer.cpp.o
-D BIT64=1 -D CAN_BUILD_WABT -D CLANG_HAS_DISABLE_TAIL_CALLS=1 -D
ENABLE_VALGRIND=1 -D FEATURE_PAL -D HAS_REAL_ICU=1 -D LINUX64 -D NO_PAL_MINMAX
-D PAL_STDCPP_COMPAT -D PLATFORM_UNIX=1 -D STACK_ALIGN=16 -D UNICODE -D _AMD64_
-D _M_AMD64 -D _M_X64 -D _M_X64_OR_ARM64 -D _SAFECRT_USE_CPP_OVERLOADS=1 -D
__LINUX__=1 -D __STDC_WANT_LIB_EXT1__=1 -I ../../. -I ../../lib/Common -I
../../lib/Common/PlaceHolder -I ../../pal -I ../../pal/inc -I ../../pal/inc/rt
-I ../../lib/Runtime/. -I ../../lib/Runtime/../JITIDL -I
../../lib/Runtime/../Common -I ../../lib/Runtime/../Backend -I
../../lib/Runtime/../Parser -I ../../lib/Runtime/../WasmReader -I
../../lib/Runtime/ByteCode -I ../../lib/Runtime/PlatformAgnostic -I
../../lib/Runtime/Math -D NDEBUG -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/x86_64-linux-gnu/c++/5.4.0
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/x86_64-linux-gnu/c++/5.4.0
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/backward
-internal-isystem /usr/local/include -internal-isystem
/usr/local/llvm-4.0.0/bin/../lib/clang/4.0.0/include -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem /include
-internal-externc-isystem /usr/include -O3 -Werror -Wno-ignored-attributes
-Wno-deprecated-declarations -Wno-parentheses-equality -Wno-missing-braces
-Wno-reorder -Wno-microsoft -Wno-unused-value -Wno-int-to-void-pointer-cast
-Wno-invalid-offsetof -Wno-undefined-inline -Wno-inconsistent-missing-override
-Wno-c++14-extensions -Wno-macro-redefined -Wno-pragmas
-Wno-invalid-token-paste -Wno-format -Wno-invalid-noreturn -Wno-null-arithmetic
-Wno-tautological-constant-out-of-range-compare
-Wno-tautological-undefined-compare -Wno-address-of-temporary
-Wno-null-conversion -Wno-return-type -Wno-switch
-Wno-implicit-function-declaration -Wno-int-to-pointer-cast -std=gnu++11
-fdeprecated-macro -fdebug-compilation-dir
/home/yumetodo/ドキュメント/ChakraCore/out/Release -ferror-limit 19 -fmessage-length
0 -fwrapv -fms-extensions -fdelayed-template-parsing -fobjc-runtime=gcc
-fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics
-fasm-blocks -vectorize-loops -vectorize-slp -o
lib/Runtime/ByteCode/CMakeFiles/Chakra.Runtime.ByteCode.dir/ByteCodeSerializer.cpp.o
-x c++ ../../lib/Runtime/ByteCode/ByteCodeSerializer.cpp 
1.      <eof> parser at end of file
2.      ../../lib/Common/DataStructures/BufferBuilder.h:213:9: instantiating
function definition 'Js::ConstantSizedBufferBuilderOf<__unaligned
Js::SerializedVarArray>::ConstantSizedBufferBuilderOf'
3.      ../../lib/Common/DataStructures/BufferBuilder.h:213:9: LLVM IR
generation of declaration 'Js::ConstantSizedBufferBuilderOf<__unaligned
Js::SerializedVarArray>::ConstantSizedBufferBuilderOf'
clang-4.0: error: unable to execute command: Aborted (core dumped)
clang-4.0: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 4.0.0 (<a href="http://llvm.org/git/clang.git">http://llvm.org/git/clang.git</a>
559aa046fe3260d8640791f2249d7b0d458b5700) (<a href="http://llvm.org/git/llvm.git">http://llvm.org/git/llvm.git</a>
4423e351176a92975739dd4ea43c2ff5877236ae)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
clang-4.0: note: diagnostic msg: PLEASE submit a bug report to
<a href="http://llvm.org/bugs/">http://llvm.org/bugs/</a> and include the crash backtrace, preprocessed source, and
associated run script.
clang-4.0: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-4.0: note: diagnostic msg: /tmp/ByteCodeSerializer-8f9b6c.cpp
clang-4.0: note: diagnostic msg: /tmp/ByteCodeSerializer-8f9b6c.sh
clang-4.0: note: diagnostic msg: 

********************
ninja: build stopped: subcommand failed.
See error details above. Exit code was 1

environment

$ uname -a
Linux yumetodo-desktop 4.4.0-75-generic #96-Ubuntu SMP Thu Apr 20 09:56:33 UTC
2017 x86_64 x86_64 x86_64 GNU/Linux
$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.2 LTS"
$ gcc --version
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
Copyright (C) 2015 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.
$ /usr/local/bin/clang-4.0 --version
clang version 4.0.0 (<a href="http://llvm.org/git/clang.git">http://llvm.org/git/clang.git</a>
559aa046fe3260d8640791f2249d7b0d458b5700) (<a href="http://llvm.org/git/llvm.git">http://llvm.org/git/llvm.git</a>
4423e351176a92975739dd4ea43c2ff5877236ae)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin


ref:
- <a href="https://github.com/Microsoft/ChakraCore/issues/2980">https://github.com/Microsoft/ChakraCore/issues/2980</a></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>