Bug#749830: /usr/bin/clang: clang++ crash when -g option used on template with pointer to member in signature

Ernie Ewert ernie at ee5.net
Fri May 30 00:50:55 UTC 2014


Package: clang-3.5
Version: 1:3.5~svn198086-1~exp1
Severity: normal
File: /usr/bin/clang

Dear Maintainer,

The following program below with the command line shown will cause
a crash.

// Save this program as crash.cpp and use the following command line.
// clang++ -std=c++11 -g crash.cpp

template<typename T,T* T::* mbr>
struct the_template
{
};

struct the_structure
{
    // anonymous union causes a crash when -g option is used
    union 
    {
        the_structure* next;
    };
};

class the_class
{
    typedef the_template<the_structure,&the_structure::next> manage_t;
    
    manage_t it;
    
public:
    the_class()
    {
    }
};

the_class boom;

int main()
{
    return 0;
}

************************

Save the program as crash.cpp and execute the command line given.

************************

vm /home/erniee/ee5_util -> clang++ -std=c++11 -g crash.cpp
0  libLLVM-3.5.so.1 0x00007fac63c6b9a2
llvm::sys::PrintStackTrace(_IO_FILE*) + 34
1  libLLVM-3.5.so.1 0x00007fac63c6b799
2  libpthread.so.0  0x00007fac62889030
3  libLLVM-3.5.so.1 0x00007fac635e3f8b llvm::Value::stripPointerCasts() +
11
4  clang            0x00000000007ee10f
clang::CodeGen::CGDebugInfo::CollectTemplateParams(clang::TemplateParameter
List const*, llvm::ArrayRef<clang::TemplateArgument>, llvm::DIFile) + 1183
5  clang            0x00000000007ee427
clang::CodeGen::CGDebugInfo::CollectCXXTemplateParams(clang::ClassTemplateS
pecializationDecl const*, llvm::DIFile) + 87
6  clang            0x00000000007f2656
clang::CodeGen::CGDebugInfo::CreateLimitedType(clang::RecordType const*) +
1494
7  clang            0x00000000007f27fb
clang::CodeGen::CGDebugInfo::getOrCreateLimitedType(clang::RecordType
const*, llvm::DIFile) + 75
8  clang            0x00000000007f2a4e
clang::CodeGen::CGDebugInfo::CreateTypeDefinition(clang::RecordType
const*) + 62       
9  clang            0x00000000007f32c2
clang::CodeGen::CGDebugInfo::CreateType(clang::RecordType const*) + 226
                   
10 clang            0x00000000007eae06
clang::CodeGen::CGDebugInfo::CreateTypeNode(clang::QualType, llvm::DIFile)
+ 326              
11 clang            0x00000000007eaf66
clang::CodeGen::CGDebugInfo::getOrCreateType(clang::QualType,
llvm::DIFile) + 166
12 clang            0x00000000007f3bc9
clang::CodeGen::CGDebugInfo::CreateType(clang::TypedefType const*,
llvm::DIFile) + 73 
13 clang            0x00000000007eae13
clang::CodeGen::CGDebugInfo::CreateTypeNode(clang::QualType, llvm::DIFile)
+ 339              
14 clang            0x00000000007eaf66
clang::CodeGen::CGDebugInfo::getOrCreateType(clang::QualType,
llvm::DIFile) + 166
15 clang            0x00000000007efe1b
clang::CodeGen::CGDebugInfo::createFieldType(llvm::StringRef,
clang::QualType, unsigned long, clang::SourceLocation,
clang::AccessSpecifier, unsigned long, llvm::DIFile, llvm::DIScope) + 75
                   
                   
16 clang            0x00000000007f0044
clang::CodeGen::CGDebugInfo::CollectRecordNormalField(clang::FieldDecl
const*, unsigned long, llvm::DIFile, llvm::SmallVectorImpl<llvm::Value*>&,
llvm::DIType) + 260
17 clang            0x00000000007f0512
clang::CodeGen::CGDebugInfo::CollectRecordFields(clang::RecordDecl const*,
llvm::DIFile, llvm::SmallVectorImpl<llvm::Value*>&, llvm::DICompositeType)
+ 386
18 clang            0x00000000007f2e5d
clang::CodeGen::CGDebugInfo::CreateTypeDefinition(clang::RecordType
const*) + 1101
19 clang            0x00000000007f32c2
clang::CodeGen::CGDebugInfo::CreateType(clang::RecordType const*) + 226
20 clang            0x00000000007eae06
clang::CodeGen::CGDebugInfo::CreateTypeNode(clang::QualType, llvm::DIFile)
+ 326
21 clang            0x00000000007eaf66
clang::CodeGen::CGDebugInfo::getOrCreateType(clang::QualType,
llvm::DIFile) + 166
22 clang            0x00000000007f37ed
clang::CodeGen::CGDebugInfo::EmitGlobalVariable(llvm::GlobalVariable*,
clang::VarDecl const*) + 477
23 clang            0x0000000000833f0a
clang::CodeGen::CodeGenModule::EmitGlobalVarDefinition(clang::VarDecl
const*) + 746
24 clang            0x000000000083685a
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl,
llvm::GlobalValue*) + 138
25 clang            0x0000000000836f5d
clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) + 1485
26 clang            0x000000000083768b
27 clang            0x00000000007e3423
28 clang            0x00000000007e2bd6
29 clang            0x00000000009490a5 clang::ParseAST(clang::Sema&, bool,
bool) + 293
30 clang            0x000000000068cb49 clang::FrontendAction::Execute() +
185
31 clang            0x000000000066d98a
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 282
32 clang            0x00000000006577e6
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1542
33 clang            0x0000000000652b70 cc1_main(char const**, char
const**, char const*, void*) + 1104
34 clang            0x0000000000650151 main + 673
35 libc.so.6        0x00007fac6152cead __libc_start_main + 253
36 clang            0x0000000000652581
Stack dump:
0.      Program arguments: /usr/bin/clang -cc1 -triple x86_64-pc-linux-gnu
-emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name
crash.cpp -mrelocation-model static -mdisable-fp-elim -fmath-errno
-masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array
-target-cpu x86-64 -target-linker-version 2.22 -g -resource-dir
/usr/bin/../lib/clang/3.5 -internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7
-internal-isystem 
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7/x86_64
-linux-gnu -internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7/backwa
rd -internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.7/../../../../include/x86_64-linux-g
nu/c++/4.7 -internal-isystem /usr/local/include -internal-isystem
/usr/bin/../lib/clang/3.5/include -internal-externc-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.7/include -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem /include
-internal-externc-isystem /usr/include -std=c++11 -fdeprecated-macro
-fdebug-compilation-dir /home/erniee/ee5_util -ferror-limit 19
-fmessage-length 175 -mstackrealign -fobjc-runtime=gcc -fcxx-exceptions
-fexceptions -fdiagnostics-show-option -fcolor-diagnostics -vectorize-slp
-o /tmp/crash-c419ad.o -x c++ crash.cpp
1.      crash.cpp:32:1: current parser token 'int'
2.      crash.cpp:30:11: LLVM IR generation of declaration 'boom'
3.      crash.cpp:30:11: Generating code for declaration 'boom'
clang: error: unable to execute command: Segmentation fault
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
Debian clang version 3.5-1~exp1 (trunk) (based on LLVM 3.5)
Target: x86_64-pc-linux-gnu
Thread model: posix
clang: note: diagnostic msg: PLEASE submit a bug report to
http://bugs.debian.org/ and include the crash backtrace, preprocessed
source, and associated run script.
clang: note: diagnostic msg:

-- System Information:
Debian Release: 7.5
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.0-4-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages clang-3.5 depends on:
ii  libc6                    2.13-38+deb7u1
ii  libclang-common-3.5-dev  1:3.5~svn198086-1~exp1
ii  libclang1-3.5            1:3.5~svn198086-1~exp1
ii  libffi5                  3.0.10-3
ii  libgcc1                  1:4.7.2-5
ii  libllvm3.5               1:3.5~svn198086-1~exp1
ii  libstdc++6               4.7.2-5
ii  libstdc++6-4.7-dev       4.7.2-5
ii  libtinfo5                5.9-10
ii  zlib1g                   1:1.2.7.dfsg-13

Versions of packages clang-3.5 recommends:
ii  llvm-3.5-dev  1:3.5~svn198086-1~exp1
ii  python        2.7.3-4+deb7u1

clang-3.5 suggests no packages.

-- no debconf information

--===============2272814344088723290==
Content-Type: text/x-c++; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="crash-9de80c.cpp"

# 1 "<built-in>" 1
# 1 "crash.cpp" 1

// clang++ -std=c++11 -g crash.cpp

template<typename T,T* T::* mbr>
struct the_template
{
};

struct the_structure
{
	// anonymous union causes a crash when -g option is used
    union 
    {
        the_structure* next;
    };
};

class the_class
{
    typedef the_template<the_structure,&the_structure::next> manage_t;
    
    manage_t it;
    
public:
    the_class()
    {
    }
};

the_class boom;

int main()
{
	return 0;
}

--===============2272814344088723290==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="crash-9de80c.sh"

 "/usr/bin/clang" -cc1 -triple x86_64-pc-linux-gnu -emit-obj -mrelax-all
-disable-free -disable-llvm-verifier -main-file-name crash.cpp
-mrelocation-model static -mdisable-fp-elim -fmath-errno -masm-verbose
-mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64
-target-linker-version 2.22 -g -std=c++11 -fdeprecated-macro -ferror-limit
19 -fmessage-length 175 -mstackrealign -fobjc-runtime=gcc -fcxx-exceptions
-fexceptions -fdiagnostics-show-option -fcolor-diagnostics -vectorize-slp
-x c++ crash-9de80c.cpp

--===============2272814344088723290==--



More information about the Pkg-llvm-team mailing list