[llvm-bugs] [Bug 32643] New: Clang crash on printing type size of incomplete template type [crash in clang::ASTContext::getASTRecordLayout]

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Apr 12 13:36:19 PDT 2017


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

            Bug ID: 32643
           Summary: Clang crash on printing type size of incomplete
                    template type [crash in
                    clang::ASTContext::getASTRecordLayout]
           Product: clang
           Version: 4.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: kfunk at kde.org
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

Clang 4.0 from Ubuntu 17.04 packages.

Downstream issue from the KDevelop IDE:
  https://bugs.kde.org/show_bug.cgi?id=376084

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

-- 
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/20170412/bb837736/attachment.html>


More information about the llvm-bugs mailing list