[llvm-bugs] [Bug 28183] New: clang crashes on C++11 code with invalid member initializer: Assertion `AddressOfExpr->getType() == Context.OverloadTy' failed

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jun 17 21:15:32 PDT 2016


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

            Bug ID: 28183
           Summary: clang crashes on C++11 code with invalid member
                    initializer: Assertion `AddressOfExpr->getType() ==
                    Context.OverloadTy' failed
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: su at cs.ucdavis.edu
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

The current clang trunk crashes when compiling the following C++11 test case on
x86_64-linux-gnu in both 32-bit and 64-bit modes. 

It seems to affect all clang versions since as early as 3.1. 


$ clang++ -v
clang version 3.9.0 (trunk 272993)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/clang-trunk/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9.3
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5.3.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.3.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
$
$ clang++ -c -std=c++11 small.cpp
clang-3.9:
/tmp/llvm-builder/llvm-source-trunk/tools/clang/lib/Sema/SemaOverload.cpp:10664:
clang::FunctionDecl*
clang::Sema::ResolveAddressOfOverloadedFunction(clang::Expr*, clang::QualType,
bool, clang::DeclAccessPair&, bool*): Assertion `AddressOfExpr->getType() ==
Context.OverloadTy' failed.
#0 0x0000000001d1b425 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/clang-trunk/bin/clang-3.9+0x1d1b425)
#1 0x0000000001d192b6 llvm::sys::RunSignalHandlers()
(/usr/local/clang-trunk/bin/clang-3.9+0x1d192b6)
#2 0x0000000001d194d4 SignalHandler(int)
(/usr/local/clang-trunk/bin/clang-3.9+0x1d194d4)
#3 0x00007fed501fc340 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10340)
#4 0x00007fed4f41acc9 gsignal
/build/eglibc-3GlaMS/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x00007fed4f41e0d8 abort
/build/eglibc-3GlaMS/eglibc-2.19/stdlib/abort.c:91:0
#6 0x00007fed4f413b86 __assert_fail_base
/build/eglibc-3GlaMS/eglibc-2.19/assert/assert.c:92:0
#7 0x00007fed4f413c32 (/lib/x86_64-linux-gnu/libc.so.6+0x2fc32)
#8 0x0000000002d1c2c0
clang::Sema::ResolveAddressOfOverloadedFunction(clang::Expr*, clang::QualType,
bool, clang::DeclAccessPair&, bool*)
(/usr/local/clang-trunk/bin/clang-3.9+0x2d1c2c0)
#9 0x0000000002c6c9b9 clang::InitializationSequence::Diagnose(clang::Sema&,
clang::InitializedEntity const&, clang::InitializationKind const&,
llvm::ArrayRef<clang::Expr*>) (/usr/local/clang-trunk/bin/clang-3.9+0x2c6c9b9)
#10 0x0000000002c6f9ad clang::InitializationSequence::Perform(clang::Sema&,
clang::InitializedEntity const&, clang::InitializationKind const&,
llvm::MutableArrayRef<clang::Expr*>, clang::QualType*)
(/usr/local/clang-trunk/bin/clang-3.9+0x2c6f9ad)
#11 0x0000000002b1b3f3 clang::Sema::BuildMemberInitializer(clang::ValueDecl*,
clang::Expr*, clang::SourceLocation)
(/usr/local/clang-trunk/bin/clang-3.9+0x2b1b3f3)
#12 0x0000000002b2b7c1 clang::Sema::BuildMemInitializer(clang::Decl*,
clang::Scope*, clang::CXXScopeSpec&, clang::IdentifierInfo*,
clang::OpaquePtr<clang::QualType>, clang::DeclSpec const&,
clang::SourceLocation, clang::Expr*, clang::SourceLocation)
(/usr/local/clang-trunk/bin/clang-3.9+0x2b2b7c1)
#13 0x0000000002b2bdeb clang::Sema::ActOnMemInitializer(clang::Decl*,
clang::Scope*, clang::CXXScopeSpec&, clang::IdentifierInfo*,
clang::OpaquePtr<clang::QualType>, clang::DeclSpec const&,
clang::SourceLocation, clang::Expr*, clang::SourceLocation)
(/usr/local/clang-trunk/bin/clang-3.9+0x2b2bdeb)
#14 0x000000000282082f clang::Parser::ParseMemInitializer(clang::Decl*)
(/usr/local/clang-trunk/bin/clang-3.9+0x282082f)
#15 0x0000000002823167 clang::Parser::ParseConstructorInitializer(clang::Decl*)
(/usr/local/clang-trunk/bin/clang-3.9+0x2823167)
#16 0x00000000027fb370
clang::Parser::ParseLexedMethodDef(clang::Parser::LexedMethod&)
(/usr/local/clang-trunk/bin/clang-3.9+0x27fb370)
#17 0x00000000027faf0e
clang::Parser::ParseLexedMethodDefs(clang::Parser::ParsingClass&)
(/usr/local/clang-trunk/bin/clang-3.9+0x27faf0e)
#18 0x000000000282bdf9
clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation,
clang::SourceLocation, clang::Parser::ParsedAttributesWithRange&, unsigned int,
clang::Decl*) (/usr/local/clang-trunk/bin/clang-3.9+0x282bdf9)
#19 0x000000000282cb1f
clang::Parser::ParseClassSpecifier(clang::tok::TokenKind,
clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo
const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext,
clang::Parser::ParsedAttributesWithRange&)
(/usr/local/clang-trunk/bin/clang-3.9+0x282cb1f)
#20 0x000000000280e830
clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&,
clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier,
clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*)
(/usr/local/clang-trunk/bin/clang-3.9+0x280e830)
#21 0x00000000027f3254
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier)
(/usr/local/clang-trunk/bin/clang-3.9+0x27f3254)
#22 0x00000000027f39b1
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier) [clone .part.222]
(/usr/local/clang-trunk/bin/clang-3.9+0x27f39b1)
#23 0x00000000027f39ef
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier)
(/usr/local/clang-trunk/bin/clang-3.9+0x27f39ef)
#24 0x00000000027f8860
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) (/usr/local/clang-trunk/bin/clang-3.9+0x27f8860)
#25 0x00000000027f9030
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
(/usr/local/clang-trunk/bin/clang-3.9+0x27f9030)
#26 0x00000000027f065b clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/clang-trunk/bin/clang-3.9+0x27f065b)
#27 0x0000000002486d3e clang::CodeGenAction::ExecuteAction()
(/usr/local/clang-trunk/bin/clang-3.9+0x2486d3e)
#28 0x00000000021977fe clang::FrontendAction::Execute()
(/usr/local/clang-trunk/bin/clang-3.9+0x21977fe)
#29 0x000000000216d266
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/clang-trunk/bin/clang-3.9+0x216d266)
#30 0x00000000022245c2
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/clang-trunk/bin/clang-3.9+0x22245c2)
#31 0x0000000000af0548 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/local/clang-trunk/bin/clang-3.9+0xaf0548)
#32 0x0000000000aa46dc main (/usr/local/clang-trunk/bin/clang-3.9+0xaa46dc)
#33 0x00007fed4f405ec5 __libc_start_main
/build/eglibc-3GlaMS/eglibc-2.19/csu/libc-start.c:321:0
#34 0x0000000000aec5b4 _start (/usr/local/clang-trunk/bin/clang-3.9+0xaec5b4)
Stack dump:
0.      Program arguments: /usr/local/clang-trunk/bin/clang-3.9 -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name
small.cpp -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 -debugger-tuning=gdb
-coverage-file /data2/small.cpp -resource-dir
/usr/local/clang-trunk/bin/../lib/clang/3.9.0 -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9 -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/x86_64-linux-gnu/c++/4.9
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/x86_64-linux-gnu/c++/4.9
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9/backward
-internal-isystem /usr/local/include -internal-isystem
/usr/local/clang-trunk/bin/../lib/clang/3.9.0/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 /data2 -ferror-limit 19 -fmessage-length 278
-fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option
-fcolor-diagnostics -o small.o -x c++ small.cpp
1.      small.cpp:5:17: current parser token '{'
2.      small.cpp:3:1: parsing struct/union/class body 'A'
clang-3.9: error: unable to execute command: Aborted (core dumped)
clang-3.9: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.9.0 (trunk 272993)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/clang-trunk/bin
clang-3.9: note: diagnostic msg: PLEASE submit a bug report to
http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and
associated run script.
clang-3.9: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-3.9: note: diagnostic msg: /tmp/small-3744d0.cpp
clang-3.9: note: diagnostic msg: /tmp/small-3744d0.sh
clang-3.9: note: diagnostic msg:

********************
$


--------------------------------


template < typename > int &f ();

struct A
{ 
  A (): i { f } { }
  int &i;
};

-- 
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/20160618/8e56d823/attachment-0001.html>


More information about the llvm-bugs mailing list