<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 crash on printing type size of incomplete template type [crash in clang::ASTContext::getASTRecordLayout]"
   href="https://bugs.llvm.org/show_bug.cgi?id=32643">32643</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Clang crash on printing type size of incomplete template type [crash in clang::ASTContext::getASTRecordLayout]
          </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++
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>kfunk@kde.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Clang 4.0 from Ubuntu 17.04 packages.

Downstream issue from the KDevelop IDE:
  <a href="https://bugs.kde.org/show_bug.cgi?id=376084">https://bugs.kde.org/show_bug.cgi?id=376084</a>

Test case:

$ cat ~/test.cpp
template<typename T> using crash = struct : public virtual T {}

$ c-index-test -test-print-type-size ~/test.cpp
0  libLLVM-4.0.so.1  0x00007f72756b3488
llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 56
1  libLLVM-4.0.so.1  0x00007f72756b156e llvm::sys::RunSignalHandlers() + 62
2  libLLVM-4.0.so.1  0x00007f72756b16aa
3  libpthread.so.0   0x00007f727969a670
4  libclang-4.0.so.1 0x00007f72782dfeea
5  libclang-4.0.so.1 0x00007f72782e05ec
6  libclang-4.0.so.1 0x00007f7278212ca2
7  libclang-4.0.so.1 0x00007f727820b40c
8  libclang-4.0.so.1 0x00007f727820b6e5
9  libclang-4.0.so.1 0x00007f727820b790
10 libclang-4.0.so.1 0x00007f727820b7a9
11 libclang-4.0.so.1 0x00007f72781d9cdb clang_Type_getSizeOf + 219
12 c-index-test      0x0000559bf1bb6e92
13 libclang-4.0.so.1 0x00007f72781aa235
14 libclang-4.0.so.1 0x00007f72781adc1d
15 libclang-4.0.so.1 0x00007f72781add46
16 libclang-4.0.so.1 0x00007f72781a9f20
17 libclang-4.0.so.1 0x00007f72781b2cd4 clang_visitChildren + 340
18 c-index-test      0x0000559bf1bb8e9f
19 c-index-test      0x0000559bf1bb935a
20 c-index-test      0x0000559bf1bbd48f
21 c-index-test      0x0000559bf1bb1dad
22 libLLVM-4.0.so.1  0x00007f72756b49ad
23 libpthread.so.0   0x00007f72796906da
24 libc.so.6         0x00007f727476717f clone + 95
zsh: segmentation fault  c-index-test -test-print-type-size ~/test.cpp

Full backtrace:
#1  0x00007ffff68105ec in
clang::ASTContext::getASTRecordLayout(clang::RecordDecl const*) const () at
/build/llvm-toolchain-4.0-Ha24C1/llvm-toolchain-4.0-4.0/tools/clang/lib/AST/RecordLayoutBuilder.cpp:192
#2  0x00007ffff6742ca2 in clang::ASTContext::getTypeInfoImpl(clang::Type
const*) const () at
/build/llvm-toolchain-4.0-Ha24C1/llvm-toolchain-4.0-4.0/tools/clang/lib/AST/ASTContext.cpp:1869
#3  0x00007ffff673b40c in clang::ASTContext::getTypeInfo(clang::Type const*)
const () at
/build/llvm-toolchain-4.0-Ha24C1/llvm-toolchain-4.0-4.0/tools/clang/lib/AST/ASTContext.cpp:1608
#4  0x00007ffff673b6e5 in clang::ASTContext::getTypeInfoInChars(clang::Type
const*) const () at
/build/llvm-toolchain-4.0-Ha24C1/llvm-toolchain-4.0-4.0/tools/clang/lib/AST/ASTContext.cpp:1560
#5  0x00007ffff673b790 in
clang::ASTContext::getTypeInfoInChars(clang::QualType) const () at
/build/llvm-toolchain-4.0-Ha24C1/llvm-toolchain-4.0-4.0/tools/clang/lib/AST/ASTContext.cpp:1567
warning: (Internal error: pc 0x7ffff673b78f in read in psymtab, but not in
symtab.)
#6  0x00007ffff673b7a9 in
clang::ASTContext::getTypeSizeInChars(clang::QualType) const () at
/build/llvm-toolchain-4.0-Ha24C1/llvm-toolchain-4.0-4.0/tools/clang/lib/AST/ASTContext.cpp:1973
warning: (Internal error: pc 0x7ffff673b7a8 in read in psymtab, but not in
symtab.)
#7  0x00007ffff6709cdb in clang_Type_getSizeOf () at
/build/llvm-toolchain-4.0-Ha24C1/llvm-toolchain-4.0-4.0/tools/clang/tools/libclang/CXType.cpp:807
#8  0x0000555555721e92 in ?? ()
#9  0x00007ffff66da235 in clang::cxcursor::CursorVisitor::Visit(CXCursor, bool)
() at
/build/llvm-toolchain-4.0-Ha24C1/llvm-toolchain-4.0-4.0/tools/clang/tools/libclang/CIndex.cpp:209
#10 0x00007ffff66ddc1d in
clang::cxcursor::CursorVisitor::handleDeclForVisitation(clang::Decl const*) ()
at
/build/llvm-toolchain-4.0-Ha24C1/llvm-toolchain-4.0-4.0/tools/clang/tools/libclang/CIndex.cpp:666
#11 0x00007ffff66ddd46 in
clang::cxcursor::CursorVisitor::VisitDeclContext(clang::DeclContext*) () at
/build/llvm-toolchain-4.0-Ha24C1/llvm-toolchain-4.0-4.0/tools/clang/tools/libclang/CIndex.cpp:627
#12 0x00007ffff66d9f20 in
clang::cxcursor::CursorVisitor::VisitChildren(CXCursor) () at
/build/llvm-toolchain-4.0-Ha24C1/llvm-toolchain-4.0-4.0/tools/clang/tools/libclang/CIndex.cpp:532
#13 0x00007ffff66e2cd4 in clang_visitChildren () at
/build/llvm-toolchain-4.0-Ha24C1/llvm-toolchain-4.0-4.0/tools/clang/tools/libclang/CIndex.cpp:4159
#14 0x0000555555723e9f in ?? ()
#15 0x000055555572435a in ?? ()
#16 0x000055555572848f in ?? ()
#17 0x000055555571cdad in ?? ()
warning: Could not find DWO CU
CMakeFiles/LLVMSupport.dir/Threading.cpp.dwo(0x363818461f04e17a) referenced by
CU at offset 0x8a05 [in module
/usr/lib/debug/.build-id/d2/9e710b4569fee5ee81383b192fd42e974908c0.debug]
#18 0x00007ffff3be49ad in ExecuteOnThread_Dispatch(void*) () at
/build/llvm-toolchain-4.0-Ha24C1/llvm-toolchain-4.0-4.0/lib/Support/Threading.cpp:42
#19 0x00007ffff7bc06da in start_thread (arg=0x7ffff1dfd700) at
pthread_create.c:456
#20 0x00007ffff2c9717f in clone () at
../sysdeps/unix/sysv/linux/x86_64/clone.S:105</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>