<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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 --- - LLVM crash in CXXNameMangler::mangleType"
   href="https://llvm.org/bugs/show_bug.cgi?id=26194">26194</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>LLVM crash in CXXNameMangler::mangleType
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>3.8
          </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>LLVM Codegen
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>reg8162@runbox.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=15656" name="attach_15656" title="OpenCL source causing crash">attachment 15656</a> <a href="attachment.cgi?id=15656&action=edit" title="OpenCL source causing crash">[details]</a></span>
OpenCL source causing crash

LLVM/clang crashes while compiling an OpenCL file. Built from release_38 branch
svn 254505. Note that this is a regression - it compiles without crash on 3.7.

To reproduce:
clang-3.8 -Xclang -ffake-address-space-map -emit-llvm -x cl -Xclang
-cl-std=CL2.0 -D__OPENCL_C_VERSION__=200 -D__OPENCL_VERSION__=200
-Dcl_khr_byte_addressable_store -Dcl_khr_global_int32_base_atomics
-Dcl_khr_global_int32_extended_atomics -Dcl_khr_local_int32_base_atomics
-Dcl_khr_local_int32_extended_atomics -Dcl_khr_spir -Dcl_khr_int64
-Dcl_khr_fp64 -Dcl_khr_int64_base_atomics -Dcl_khr_int64_extended_atomics -o
attach.bc -c attach.cl

Preprocessed source is attached; original sources are at
<a href="https://github.com/pocl/pocl/blob/3254f46a388b3809c6eea1bd70943864198dd56c/">https://github.com/pocl/pocl/blob/3254f46a388b3809c6eea1bd70943864198dd56c/</a> 
files lib/kernel/svm_atomics.cl and include/_kernel.h

Stack dump:
0.    Program arguments: /home/LLVM_380_rwdi_NA_rtti/bin/clang-3.8 -cc1 -triple
x86_64-unknown-linux-gnu -emit-llvm-bc -emit-llvm-uselists -disable-free
-disable-llvm-verifier -main-file-name a.cl -mrelocation-model static
-mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose
-mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64
-dwarf-column-info -coverage-file /tmp/a -resource-dir
/home/LLVM_380_rwdi_NA_rtti/bin/../lib/clang/3.8.0 -D __OPENCL_C_VERSION__=200
-D __OPENCL_VERSION__=200 -D cl_khr_byte_addressable_store -D
cl_khr_global_int32_base_atomics -D cl_khr_global_int32_extended_atomics -D
cl_khr_local_int32_base_atomics -D cl_khr_local_int32_extended_atomics -D
cl_khr_spir -D cl_khr_int64 -D cl_khr_fp64 -D cl_khr_int64_base_atomics -D
cl_khr_int64_extended_atomics -internal-isystem /usr/local/include
-internal-isystem /home/LLVM_380_rwdi_NA_rtti/bin/../lib/clang/3.8.0/include
-internal-externc-isystem /include -internal-externc-isystem /usr/include
-fdebug-compilation-dir /home/build-pocl-debug -ferror-limit 19
-fmessage-length 159 -fobjc-runtime=gcc -fdiagnostics-show-option
-fcolor-diagnostics -ffake-address-space-map -cl-std=CL2.0  -o
/home/build-pocl-debug/lib/kernel/host/svm_atomics.cl.bc -x cl
/home/devel/a/0/pocl/lib/kernel/svm_atomics.cl
1.    /home/devel/a/0/pocl/lib/kernel/svm_atomics.cl:218:1: current parser
token 'bool'
2.    /home/devel/a/0/pocl/lib/kernel/svm_atomics.cl:210:40: LLVM IR generation
of declaration 'atomic_compare_exchange_strong'
3.    /home/devel/a/0/pocl/lib/kernel/svm_atomics.cl:210:40: Generating code
for declaration 'atomic_compare_exchange_strong'
4.    /home/devel/a/0/pocl/lib/kernel/svm_atomics.cl:210:40: Mangling
declaration 'atomic_compare_exchange_strong'



gdb backtrace:
Program terminated with signal SIGSEGV, Segmentation fault.
#0  std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >::_M_data (this=<optimized out>, 
    __p=0xfffffffffff4d113 <error: Cannot access memory at address
0xfffffffffff4d113>) at /usr/include/c++/5.3.0/bits/basic_string.h:127
127          { _M_dataplus._M_p = __p; }
(gdb) bt
#0  std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >::_M_data (this=<optimized out>, 
    __p=0xfffffffffff4d113 <error: Cannot access memory at address
0xfffffffffff4d113>) at /usr/include/c++/5.3.0/bits/basic_string.h:127
#1  std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >::basic_string(std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char> >&&) (__str=<optimized out>,
this=0xffff0300) at /usr/include/c++/5.3.0/bits/basic_string.h:495
#2  std::operator+<char, std::char_traits<char>, std::allocator<char> >(char
const*, std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >&&) (__rhs=<unknown type in
/home/LLVM_380_rwdi_NA_rtti/lib/.debug/libclangAST.so.debug, CU 0x1a9c8b4, DIE
0x1b6e435>, __lhs=0x7efd4984707e "AS")
    at /usr/include/c++/5.3.0/bits/basic_string.h:4876
#3  (anonymous namespace)::CXXNameMangler::mangleQualifiers (Quals=...,
Quals@entry=..., this=0x7ffecd7dec40, this=0x7ffecd7dec40)
    at /home/unused_LLVM/LLVM_git/tools/clang/lib/AST/ItaniumMangle.cpp:1788
#4  0x00007efd4979637f in (anonymous namespace)::CXXNameMangler::mangleType
(this=this@entry=0x7ffecd7dec40, T=...)
    at /home/unused_LLVM/LLVM_git/tools/clang/lib/AST/ItaniumMangle.cpp:1931
#5  0x00007efd49798641 in (anonymous namespace)::CXXNameMangler::mangleType
(this=this@entry=0x7ffecd7dec40, T=T@entry=0x1469e60)
    at /home/unused_LLVM/LLVM_git/tools/clang/lib/AST/ItaniumMangle.cpp:2302
#6  0x00007efd49796b8e in (anonymous namespace)::CXXNameMangler::mangleType
(this=this@entry=0x7ffecd7dec40, T=...)
    at
/home/unused_LLVM/LLVM_git/tools/clang/include/clang/AST/TypeNodes.def:64
#7  0x00007efd497986cf in (anonymous
namespace)::CXXNameMangler::mangleBareFunctionType (this=0x7ffecd7dec40,
T=0x1469fc0, MangleReturnType=<optimized out>)
    at /home/unused_LLVM/LLVM_git/tools/clang/lib/AST/ItaniumMangle.cpp:2198
#8  0x00007efd4979ef98 in (anonymous
namespace)::ItaniumMangleContextImpl::mangleCXXName (this=0xfc4bf0,
D=0x158e208, Out=...)
    at /home/unused_LLVM/LLVM_git/tools/clang/lib/AST/ItaniumMangle.cpp:4023
#9  0x00007efd4d803f84 in clang::CodeGen::CodeGenModule::getMangledName
(this=this@entry=0xfc41a0, GD=..., GD@entry=...)
    at /home/unused_LLVM/LLVM_git/tools/clang/lib/CodeGen/CodeGenModule.cpp:619
#10 0x00007efd4d808c47 in clang::CodeGen::CodeGenModule::GetAddrOfFunction
(this=this@entry=0xfc41a0, GD=GD@entry=..., Ty=0xfc6060, 
    ForVTable=ForVTable@entry=false, DontDefer=DontDefer@entry=true,
IsForDefinition=IsForDefinition@entry=true)
    at
/home/unused_LLVM/LLVM_git/tools/clang/lib/CodeGen/CodeGenModule.cpp:1836
#11 0x00007efd4d808d03 in
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition
(this=this@entry=0xfc41a0, GD=GD@entry=..., GV=GV@entry=0x0)
    at
/home/unused_LLVM/LLVM_git/tools/clang/lib/CodeGen/CodeGenModule.cpp:2665
#12 0x00007efd4d817bdb in clang::CodeGen::CodeGenModule::EmitGlobalDefinition
(this=this@entry=0xfc41a0, GD=GD@entry=..., GV=GV@entry=0x0)
    at
/home/unused_LLVM/LLVM_git/tools/clang/lib/CodeGen/CodeGenModule.cpp:1646
#13 0x00007efd4d818710 in clang::CodeGen::CodeGenModule::EmitGlobal
(this=this@entry=0xfc41a0, GD=GD@entry=...)
    at
/home/unused_LLVM/LLVM_git/tools/clang/lib/CodeGen/CodeGenModule.cpp:1464
#14 0x00007efd4d819090 in clang::CodeGen::CodeGenModule::EmitTopLevelDecl
(this=0xfc41a0, D=0x158e208)
    at
/home/unused_LLVM/LLVM_git/tools/clang/lib/CodeGen/CodeGenModule.cpp:3457
#15 0x00007efd4d860bef in (anonymous
namespace)::CodeGeneratorImpl::HandleTopLevelDecl (this=0xfc3a60, DG=...)
    at /home/unused_LLVM/LLVM_git/tools/clang/lib/CodeGen/ModuleBuilder.cpp:125
#16 0x00007efd4d7e7564 in clang::BackendConsumer::HandleTopLevelDecl
(this=0xfc3910, D=...)
    at /home/unused_LLVM/LLVM_git/tools/clang/lib/CodeGen/CodeGenAction.cpp:114
#17 0x00007efd48e3ff77 in clang::ParseAST (S=..., PrintStats=<optimized out>,
SkipFunctionBodies=<optimized out>)
    at /home/unused_LLVM/LLVM_git/tools/clang/lib/Parse/ParseAST.cpp:159
#18 0x00007efd4d0666ea in clang::ASTFrontendAction::ExecuteAction
(this=this@entry=0xf92990)
    at
/home/unused_LLVM/LLVM_git/tools/clang/lib/Frontend/FrontendAction.cpp:539
#19 0x00007efd4d7e82f2 in clang::CodeGenAction::ExecuteAction (this=0xf92990)
at /home/unused_LLVM/LLVM_git/tools/clang/lib/CodeGen/CodeGenAction.cpp:797
#20 0x00007efd4d067346 in clang::FrontendAction::Execute
(this=this@entry=0xf92990)
    at
/home/unused_LLVM/LLVM_git/tools/clang/lib/Frontend/FrontendAction.cpp:439
#21 0x00007efd4d037946 in clang::CompilerInstance::ExecuteAction
(this=this@entry=0xf8f380, Act=...)
    at
/home/unused_LLVM/LLVM_git/tools/clang/lib/Frontend/CompilerInstance.cpp:841
#22 0x00007efd4cdbf9e5 in clang::ExecuteCompilerInvocation
(Clang=Clang@entry=0xf8f380)
    at
/home/unused_LLVM/LLVM_git/tools/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:222
#23 0x000000000040f0f8 in cc1_main (Argv=..., Argv0=<optimized out>,
MainAddr=MainAddr@entry=0x40d520 <GetExecutablePath[abi:cxx11](char const*,
bool)>)
    at /home/unused_LLVM/LLVM_git/tools/clang/tools/driver/cc1_main.cpp:116
#24 0x000000000040a56e in ExecuteCC1Tool (Tool=..., argv=...) at
/home/unused_LLVM/LLVM_git/tools/clang/tools/driver/driver.cpp:301</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>