LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 43416 - After r360109, Assertion failed: (Chunk.Kind == DeclaratorChunk::Function), function VisitFunctionTypeLoc, file clang/lib/Sema/SemaType.cpp, line 5642.
Summary: After r360109, Assertion failed: (Chunk.Kind == DeclaratorChunk::Function), f...
Status: RESOLVED DUPLICATE of bug 43315
Alias: None
Product: clang
Classification: Unclassified
Component: -New Bugs (show other bugs)
Version: trunk
Hardware: PC All
: P normal
Assignee: Unassigned Clang Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-09-23 12:11 PDT by Dimitry Andric
Modified: 2019-09-23 22:12 PDT (History)
5 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dimitry Andric 2019-09-23 12:11:03 PDT
As reported in https://bugs.freebsd.org/240764, clang 9.0.0 (and recent trunk) give an assertion when compiling parts of VirtualBox:

Assertion failed: (Chunk.Kind == DeclaratorChunk::Function), function VisitFunctionTypeLoc, file /home/dim/src/llvm/trunk/tools/clang/lib/Sema/SemaType.cpp, line 5655.

#0  thr_kill () at thr_kill.S:3
#1  0x0000000804e2d934 in __raise (s=6) at /usr/src/lib/libc/gen/raise.c:52
#2  0x0000000804da0d99 in abort () at /usr/src/lib/libc/stdlib/abort.c:67
#3  0x0000000804e1d5c1 in __assert (func=<optimized out>, file=<optimized out>, line=<optimized out>, failedexpr=<optimized out>) at /usr/src/lib/libc/gen/assert.c:51
#4  0x00000000044abdd9 in ?? ()
#5  0x0000000004493e29 in ?? ()
#6  0x000000000448935b in clang::Sema::GetTypeForDeclarator(clang::Declarator&, clang::Scope*) ()
#7  0x0000000003ec8630 in clang::Sema::HandleDeclarator(clang::Scope*, clang::Declarator&, llvm::MutableArrayRef<clang::TemplateParameterList*>) ()
#8  0x0000000003ec823b in clang::Sema::ActOnDeclarator(clang::Scope*, clang::Declarator&) ()
#9  0x0000000003cb9112 in clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*) ()
#10 0x0000000003cb7e59 in clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::SourceLocation*, clang::Parser::ForRangeInit*) ()
#11 0x0000000003cb302c in clang::Parser::ParseSimpleDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&, bool, clang::Parser::ForRangeInit*, clang::SourceLocation*) ()
#12 0x0000000003cb2a33 in clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&, clang::SourceLocation*) ()
#13 0x0000000003c85944 in clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*) ()
#14 0x0000000003c8401e in clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool) ()
#15 0x0000000003c7ed17 in clang::ParseAST(clang::Sema&, bool, bool) ()
#16 0x00000000033d9413 in clang::FrontendAction::Execute() ()
#17 0x0000000003352348 in clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) ()
#18 0x000000000347e8a5 in clang::ExecuteCompilerInvocation(clang::CompilerInstance*) ()
#19 0x00000000016696bc in cc1_main(llvm::ArrayRef<char const*>, char const*, void*) ()
#20 0x00000000016670d7 in main ()

This regressed with https://reviews.llvm.org/rL360109 (Recommit r359859 "[Attribute/Diagnostics] Print macro if definition is an attribute declaration").

Minimized test case:

// clang -cc1 -triple x86_64-- -S tstVMStructRC-min.cpp
#define a __attribute__((__cdecl__, __regparm__(0)))
int(a b)();
Comment 1 Leonard Chan 2019-09-23 15:23:12 PDT
Sorry for the delayed response. I'm looking into this bug and also saw the other one.
Comment 2 Dimitry Andric 2019-09-23 22:12:12 PDT
Ah I had forgotten about the earlier bug report! That is indeed exactly the same issue.

*** This bug has been marked as a duplicate of bug 43315 ***