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)();
Sorry for the delayed response. I'm looking into this bug and also saw the other one.
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 ***