[LLVMbugs] [Bug 9864] New: crash after error using sizeof on class with incomplete array member
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Fri May 6 19:36:01 PDT 2011
http://llvm.org/bugs/show_bug.cgi?id=9864
Summary: crash after error using sizeof on class with
incomplete array member
Product: clang
Version: unspecified
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: richard-llvm at metafoo.co.uk
CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com
<stdin>:1:16: error: field has incomplete type 'int []'
struct S { int xs[]; int n; S() : n(sizeof(S)) { } };
^
clang: /home/tla/Projects/llvm/src/tools/clang/lib/Sema/SemaDeclCXX.cpp:2226:
bool clang::Sema::SetCtorInitializers(clang::CXXConstructorDecl*,
clang::CXXCtorInitializer**, unsigned int, bool): Assertion
`ClassDecl->hasFlexibleArrayMember() && "Incomplete array type is not valid"'
failed.
0 libLLVM-3.0svn.so 0x00007f25420d67ef
1 libLLVM-3.0svn.so 0x00007f25420d8a62
2 libpthread.so.0 0x00007f25410418f0
3 libc.so.6 0x00007f2540330a75 gsignal + 53
4 libc.so.6 0x00007f25403345c0 abort + 384
5 libc.so.6 0x00007f2540329941 __assert_fail + 241
6 clang 0x00000000008afd50
clang::Sema::SetCtorInitializers(clang::CXXConstructorDecl*,
clang::CXXCtorInitializer**, unsigned int, bool) + 4416
7 clang 0x00000000008b0f92
clang::Sema::ActOnMemInitializers(clang::Decl*, clang::SourceLocation,
clang::CXXCtorInitializer**, unsigned int, bool) + 2994
8 clang 0x00000000007d7402
clang::Parser::ParseConstructorInitializer(clang::Decl*) + 930
9 clang 0x00000000007c250c
clang::Parser::ParseLexedMethodDef(clang::Parser::LexedMethod&) + 908
10 clang 0x00000000007bff50
clang::Parser::ParseLexedMethodDefs(clang::Parser::ParsingClass&) + 144
11 clang 0x00000000007da57c
clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation, unsigned int,
clang::Decl*) + 1724
12 clang 0x00000000007db681
clang::Parser::ParseClassSpecifier(clang::tok::TokenKind,
clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo
const&, clang::AccessSpecifier, bool) + 3729
13 clang 0x00000000007c95e3
clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&,
clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier,
clang::Parser::DeclSpecContext) + 3395
14 clang 0x00000000007bb5df
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsingDeclSpec&,
clang::AccessSpecifier) + 95
15 clang 0x00000000007bba8a
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&,
clang::AccessSpecifier) + 522
16 clang 0x00000000007bec7a
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::Parser::ParsingDeclSpec*) + 1546
17 clang 0x00000000007bedc6
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 134
18 clang 0x000000000079be0d clang::ParseAST(clang::Sema&, bool) +
269
19 clang 0x000000000066b3d4 clang::CodeGenAction::ExecuteAction() +
68
20 clang 0x0000000000557533
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 371
21 clang 0x000000000052eb34
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1268
22 clang 0x00000000005259eb cc1_main(char const**, char const**,
char const*, void*) + 683
23 clang 0x000000000052d987 main + 6295
24 libc.so.6 0x00007f254031bc4d __libc_start_main + 253
25 clang 0x0000000000523eb9
Stack dump:
0. Program arguments:
/home/tla/Projects/llvm/build/Release+Asserts/bin/clang -cc1 -fsyntax-only -x
c++ -O3 -emit-llvm
1. <stdin>:1:48: current parser token '{'
2. <stdin>:1:1: parsing struct/union/class body 'S'
Aborted
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list