[cfe-dev] Assertion failed instead of proper diagnostic

Douglas Gregor dgregor at apple.com
Mon Nov 2 09:41:06 PST 2009


It looks like we're missing a call to Sema::RequireCompleteType. in  
our handling of __builtin_offsetof. Please file a bug at

   http://llvm.org/bugs/

	- Doug

On Nov 2, 2009, at 8:40 AM, Abramo Bagnara wrote:

>
> The attached one line C program shows the problem:
>
> $ llvm_new/Debug/bin/clang-cc bug_clang.c
> clang-cc: SemaLookup.cpp:817: bool
> clang::Sema::LookupQualifiedName(clang::Sema::LookupResult&,
> clang::DeclContext*, clang::DeclarationName,
> clang::Sema::LookupNameKind, bool): Assertion `(!isa<TagDecl> 
> (LookupCtx)
> || LookupCtx->isDependentContext() ||
> cast<TagDecl>(LookupCtx)->isDefinition() ||
> Context.getTypeDeclType(cast<TagDecl>(LookupCtx))->getAs<TagType>()
> ->isBeingDefined()) && "Declaration context must already be  
> complete!"'
> failed.
> 0  clang-cc        0x00000000010b55af
> 1  clang-cc        0x00000000010b5b0e
> 2  libpthread.so.0 0x00000036aa80f0f0
> 3  libc.so.6       0x00000036a9c32f05 gsignal + 53
> 4  libc.so.6       0x00000036a9c34a73 abort + 387
> 5  libc.so.6       0x00000036a9c2bef9 __assert_fail + 233
> 6  clang-cc        0x000000000076397c
> 7  clang-cc        0x0000000000732d8a
> 8  clang-cc        0x00000000008a645b
> 9  clang-cc        0x00000000008a8acd
> 10 clang-cc        0x00000000008a9dc7
> 11 clang-cc        0x00000000008a310e
> 12 clang-cc        0x00000000008a4237
> 13 clang-cc        0x00000000008bae4a
> 14 clang-cc        0x00000000008be769
> 15 clang-cc        0x00000000008becc6
> 16 clang-cc        0x000000000088c578
> 17 clang-cc        0x000000000088d07b
> 18 clang-cc        0x000000000088d6bf
> 19 clang-cc        0x000000000088d773
> 20 clang-cc        0x00000000006b50b7
> 21 clang-cc        0x000000000042c63b
> 22 clang-cc        0x000000000042d79b main + 3320
> 23 libc.so.6       0x00000036a9c1e576 __libc_start_main + 230
> 24 clang-cc        0x0000000000424bc9
> Stack dump:
> 0.	Program arguments: llvm_new/Debug/bin/clang-cc bug_clang.c
> 1.	bug_clang.c:7:34: current parser token ';'
> 2.	bug_clang.c:6:18: parsing function body 'f'
> 3.	bug_clang.c:6:18: in compound statement ('{}')
> Aborted
> int i = __builtin_offsetof(struct s, f);
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev




More information about the cfe-dev mailing list