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 49235 - clang: assertion `D.getASTContext().getLangOpts().CPlusPlus` failed
Summary: clang: assertion `D.getASTContext().getLangOpts().CPlusPlus` failed
Status: NEW
Alias: None
Product: clang
Classification: Unclassified
Component: -New Bugs (show other bugs)
Version: trunk
Hardware: PC Linux
: P normal
Assignee: Unassigned Clang Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-02-17 17:25 PST by Zhuo Zhang
Modified: 2021-02-18 15:07 PST (History)
4 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 Zhuo Zhang 2021-02-17 17:25:35 PST
It may be duplicated with https://bugs.llvm.org/show_bug.cgi?id=44758.

$ cat test.c
int main() {
    struct {
        int x __attribute__((aligned(({ a(); }))));
    } x;
}

$ ./clang -c test.c
test.c:3:41: warning: implicit declaration of function 'a' is invalid in C99 [-Wimplicit-function-declaration]
        int x __attribute__((aligned(({ a(); }))));
                                        ^
clang: /home/xxx/data/git/llvm-project/clang/lib/AST/Decl.cpp:2052: bool isDeclExternC(const T &) [T = clang::FunctionDecl]: Assertion `D.getASTContext().getLangOpts().CPlusPlus' failed.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: /data/xxx/git/llvm-project/build/bin/clang -c test.c
1.      test.c:3:41: current parser token 'a'
2.      test.c:1:12: parsing function body 'main'
3.      test.c:1:12: in compound statement ('{}')
4.      test.c:2:5: parsing struct/union body ''
5.      test.c:3:39: in compound statement ('{}')
 #0 0x0000000006e97306 llvm::sys::PrintStackTrace(llvm::raw_ostream&) /home/xxx/data/git/llvm-project/llvm/lib/Support/Unix/Signals.inc:560:7
 #1 0x0000000006e9266e llvm::sys::RunSignalHandlers() /home/xxx/data/git/llvm-project/llvm/lib/Support/Signals.cpp:69:18
 #2 0x0000000006e95560 llvm::sys::CleanupOnSignal(unsigned long) /home/xxx/data/git/llvm-project/llvm/lib/Support/Unix/Signals.inc:361:3
 #3 0x0000000006c878a5 (anonymous namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long) /home/xxx/data/git/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:77:5
 #4 0x0000000006c87d20 CrashRecoverySignalHandler(int) /home/xxx/data/git/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:383:1
 #5 0x00007f9ac4c598a0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x128a0)
 #6 0x00007f9ac391ff47 gsignal /build/glibc-2ORdQG/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
 #7 0x00007f9ac39218b1 abort /build/glibc-2ORdQG/glibc-2.27/stdlib/abort.c:81:0
 #8 0x00007f9ac391142a __assert_fail_base /build/glibc-2ORdQG/glibc-2.27/assert/assert.c:89:0
 #9 0x00007f9ac39114a2 (/lib/x86_64-linux-gnu/libc.so.6+0x304a2)
#10 0x000000000f31cab6 /home/xxx/data/git/llvm-project/clang/lib/AST/Decl.cpp:2052:5
#11 0x000000000cee82c2 bool isIncompleteDeclExternC<clang::FunctionDecl>(clang::Sema&, clang::FunctionDecl const*) /home/xxx/data/git/llvm-project/clang/lib/Sema/SemaDecl.cpp:6602:13
#12 0x000000000cebca55 clang::Sema::ActOnFunctionDeclarator(clang::Scope*, clang::Declarator&, clang::DeclContext*, clang::TypeSourceInfo*, clang::LookupResult&, llvm::MutableArrayRef<clang::TemplateParameterList*>, bool&) /home/xxx/data/git/llvm-project/clang/lib/Sema/SemaDecl.cpp:9700:7
#13 0x000000000ceaca94 clang::Sema::HandleDeclarator(clang::Scope*, clang::Declarator&, llvm::MutableArrayRef<clang::TemplateParameterList*>) /home/xxx/data/git/llvm-project/clang/lib/Sema/SemaDecl.cpp:5868:11
#14 0x000000000ceaa141 clang::Sema::ActOnDeclarator(clang::Scope*, clang::Declarator&) /home/xxx/data/git/llvm-project/clang/lib/Sema/SemaDecl.cpp:5544:15
#15 0x000000000ce69606 clang::Sema::ImplicitlyDefineFunction(clang::SourceLocation, clang::IdentifierInfo&, clang::Scope*) /home/xxx/data/git/llvm-project/clang/lib/Sema/SemaDecl.cpp:14661:41
#16 0x000000000ce64a09 clang::Sema::ClassifyName(clang::Scope*, clang::CXXScopeSpec&, clang::IdentifierInfo*&, clang::SourceLocation, clang::Token const&, clang::CorrectionCandidateCallback*) /home/xxx/data/git/llvm-project/clang/lib/Sema/SemaDecl.cpp:929:26
#17 0x000000000c8369ed clang::Parser::TryAnnotateName(clang::CorrectionCandidateCallback*) /home/xxx/data/git/llvm-project/clang/lib/Parse/Parser.cpp:1627:53
#18 0x000000000ca0874b clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::Parser::ParsedAttributesWithRange&) /home/xxx/data/git/llvm-project/clang/lib/Parse/ParseStmt.cpp:191:11
#19 0x000000000ca081a6 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) /home/xxx/data/git/llvm-project/clang/lib/Parse/ParseStmt.cpp:106:20
#20 0x000000000ca1c77e clang::Parser::ParseCompoundStatementBody(bool) /home/xxx/data/git/llvm-project/clang/lib/Parse/ParseStmt.cpp:1089:11
#21 0x000000000ca1a464 clang::Parser::ParseScope::~ParseScope() /home/xxx/data/git/llvm-project/clang/include/clang/Parse/Parser.h:0:0
#22 0x000000000ca1a464 clang::Parser::ParseCompoundStatement(bool, unsigned int) /home/xxx/data/git/llvm-project/clang/lib/Parse/ParseStmt.cpp:904:0
#23 0x000000000c91556d clang::Parser::ParseParenExpression(clang::Parser::ParenParseOption&, bool, bool, clang::OpaquePtr<clang::QualType>&, clang::SourceLocation&) /home/xxx/data/git/llvm-project/clang/lib/Parse/ParseExpr.cpp:2872:16
#24 0x000000000c90fc2e clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&, clang::Parser::TypeCastState, bool, bool*) /home/xxx/data/git/llvm-project/clang/lib/Parse/ParseExpr.cpp:957:11
#25 0x000000000c902c60 clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, clang::Parser::TypeCastState, bool, bool*) /home/xxx/data/git/llvm-project/clang/lib/Parse/ParseExpr.cpp:681:20
#26 0x000000000c8fe5ef clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) /home/xxx/data/git/llvm-project/clang/lib/Parse/ParseExpr.cpp:176:10
#27 0x000000000c8627aa _ZN4llvm12function_refIFN5clang12ActionResultIPNS1_4ExprELb1EEES4_EEC2IZNS1_4Sema25CorrectDelayedTyposInExprES5_PNS1_7VarDeclEbS7_Ed_UlS4_E_EEOT_PNSt9enable_ifIXntsr3std7is_sameINSt9remove_cvINSt16remove_referenceISD_E4typeEE4typeES7_EE5valueEvE4typeE /home/xxx/data/git/llvm-project/llvm/include/llvm/ADT/STLExtras.h:0:0
#28 0x000000000c8627aa clang::Parser::ParseAttributeArgsCommon(clang::IdentifierInfo*, clang::SourceLocation, clang::ParsedAttributes&, clang::SourceLocation*, clang::IdentifierInfo*, clang::SourceLocation, clang::AttributeCommonInfo::Syntax) /home/xxx/data/git/llvm-project/clang/lib/Parse/ParseDecl.cpp:397:0
#29 0x000000000c86049b clang::Parser::ParseGNUAttributeArgs(clang::IdentifierInfo*, clang::SourceLocation, clang::ParsedAttributes&, clang::SourceLocation*, clang::IdentifierInfo*, clang::SourceLocation, clang::AttributeCommonInfo::Syntax, clang::Declarator*) /home/xxx/data/git/llvm-project/clang/lib/Parse/ParseDecl.cpp:480:3
#30 0x000000000c85ed4a clang::Parser::ParseGNUAttributes(clang::ParsedAttributes&, clang::SourceLocation*, clang::Parser::LateParsedAttrList*, clang::Declarator*) /home/xxx/data/git/llvm-project/clang/lib/Parse/ParseDecl.cpp:189:9
#31 0x000000000c84163e clang::Parser::MaybeParseGNUAttributes(clang::Declarator&, clang::Parser::LateParsedAttrList*) /home/xxx/data/git/llvm-project/clang/include/clang/Parse/Parser.h:2650:31
#32 0x000000000c89229a llvm::function_ref<void (clang::ParsingFieldDeclarator&)>::operator()(clang::ParsingFieldDeclarator&) const /home/xxx/data/git/llvm-project/llvm/include/llvm/ADT/STLExtras.h:0:0
#33 0x000000000c89229a clang::Parser::ParseStructDeclaration(clang::ParsingDeclSpec&, llvm::function_ref<void (clang::ParsingFieldDeclarator&)>) /home/xxx/data/git/llvm-project/clang/lib/Parse/ParseDecl.cpp:4088:0
#34 0x000000000c89354a clang::ParsingDeclSpec::~ParsingDeclSpec() /home/xxx/data/git/llvm-project/clang/include/clang/Parse/RAIIObjectsForParser.h:0:0
#35 0x000000000c89354a clang::Parser::ParseStructUnionBody(clang::SourceLocation, clang::TypeSpecifierType, clang::RecordDecl*) /home/xxx/data/git/llvm-project/clang/lib/Parse/ParseDecl.cpp:4179:0
#36 0x000000000c8d1a67 clang::Parser::ParseClassSpecifier(clang::tok::TokenKind, clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext, clang::Parser::ParsedAttributesWithRange&) /home/xxx/data/git/llvm-project/clang/lib/Parse/ParseDeclCXX.cpp:1969:20
#37 0x000000000c8744f9 clang::ParsedAttributesView::empty() const /home/xxx/data/git/llvm-project/clang/include/clang/Sema/ParsedAttr.h:0:0
#38 0x000000000c8744f9 clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*) /home/xxx/data/git/llvm-project/clang/lib/Parse/ParseDecl.cpp:3839:0
#39 0x000000000c8735e7 clang::Parser::ParseSimpleDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&, bool, clang::Parser::ForRangeInit*, clang::SourceLocation*) /home/xxx/data/git/llvm-project/clang/lib/Parse/ParseDecl.cpp:1675:10
#40 0x000000000c873179 clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&, clang::SourceLocation*) /home/xxx/data/git/llvm-project/clang/lib/Parse/ParseDecl.cpp:0:12
#41 0x000000000ca08d41 clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::Parser::ParsedAttributesWithRange&) /home/xxx/data/git/llvm-project/clang/lib/Parse/ParseStmt.cpp:0:13
#42 0x000000000ca081a6 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) /home/xxx/data/git/llvm-project/clang/lib/Parse/ParseStmt.cpp:106:20
#43 0x000000000ca1c77e clang::Parser::ParseCompoundStatementBody(bool) /home/xxx/data/git/llvm-project/clang/lib/Parse/ParseStmt.cpp:1089:11
#44 0x000000000ca1f748 clang::ActionResult<clang::Stmt*, true>::isInvalid() const /home/xxx/data/git/llvm-project/clang/include/clang/Sema/Ownership.h:0:0
#45 0x000000000ca1f748 clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) /home/xxx/data/git/llvm-project/clang/lib/Parse/ParseStmt.cpp:2240:0
#46 0x000000000c833117 clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) /home/xxx/data/git/llvm-project/clang/lib/Parse/Parser.cpp:1339:10
#47 0x000000000c88224e clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::SourceLocation*, clang::Parser::ForRangeInit*) /home/xxx/data/git/llvm-project/clang/lib/Parse/ParseDecl.cpp:1926:18
#48 0x000000000c83020d clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec&, clang::AccessSpecifier) /home/xxx/data/git/llvm-project/clang/lib/Parse/Parser.cpp:0:10
#49 0x000000000c82e939 clang::Parser::ObjCDeclContextSwitch::~ObjCDeclContextSwitch() /home/xxx/data/git/llvm-project/clang/include/clang/Parse/Parser.h:0:0
#50 0x000000000c82e939 clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*, clang::AccessSpecifier) /home/xxx/data/git/llvm-project/clang/lib/Parse/Parser.cpp:1116:0
#51 0x000000000c82c6a1 clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*) /home/xxx/data/git/llvm-project/clang/lib/Parse/Parser.cpp:935:12
#52 0x000000000c827ecc clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool) /home/xxx/data/git/llvm-project/clang/lib/Parse/Parser.cpp:683:10
#53 0x000000000c826ccc clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) /home/xxx/data/git/llvm-project/clang/lib/Parse/Parser.cpp:555:26
#54 0x000000000c81cf4a clang::ParseAST(clang::Sema&, bool, bool) /home/xxx/data/git/llvm-project/clang/lib/Parse/ParseAST.cpp:157:15
#55 0x000000000861c2a2 clang::ASTFrontendAction::ExecuteAction() /home/xxx/data/git/llvm-project/clang/lib/Frontend/FrontendAction.cpp:1059:1
#56 0x00000000099decd8 clang::CodeGenAction::ExecuteAction() /home/xxx/data/git/llvm-project/clang/lib/CodeGen/CodeGenAction.cpp:1184:28
#57 0x000000000861a51a clang::FrontendAction::Execute() /home/xxx/data/git/llvm-project/clang/lib/Frontend/FrontendAction.cpp:954:10
#58 0x000000000854eaa7 llvm::Error::operator bool() /home/xxx/data/git/llvm-project/llvm/include/llvm/Support/Error.h:0:0
#59 0x000000000854eaa7 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) /home/xxx/data/git/llvm-project/clang/lib/Frontend/CompilerInstance.cpp:984:0
#60 0x00000000088f183f clang::CompilerInstance::getFrontendOpts() /home/xxx/data/git/llvm-project/clang/include/clang/Frontend/CompilerInstance.h:0:0
#61 0x00000000088f183f clang::ExecuteCompilerInvocation(clang::CompilerInstance*) /home/xxx/data/git/llvm-project/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:279:0
#62 0x0000000000b094cc llvm::TimeTraceScope::~TimeTraceScope() /home/xxx/data/git/llvm-project/llvm/include/llvm/Support/TimeProfiler.h:0:0
#63 0x0000000000b094cc cc1_main(llvm::ArrayRef<char const*>, char const*, void*) /home/xxx/data/git/llvm-project/clang/tools/driver/cc1_main.cpp:241:0
#64 0x0000000000afaf3b ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) /home/xxx/data/git/llvm-project/clang/tools/driver/driver.cpp:330:12
#65 0x00000000082c1350 clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, bool*) const::$_1::operator()() const /home/xxx/data/git/llvm-project/clang/lib/Driver/Job.cpp:400:30
#66 0x00000000082c1350 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, bool*) const::$_1>(long) /home/xxx/data/git/llvm-project/llvm/include/llvm/ADT/STLExtras.h:185:0
#67 0x0000000006c8767d llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) /home/xxx/data/git/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:420:1
#68 0x00000000082bfbe7 clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, bool*) const /home/xxx/data/git/llvm-project/clang/lib/Driver/Job.cpp:400:12
#69 0x000000000822acca std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::empty() const /usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/basic_string.h:0:0
#70 0x000000000822acca clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&) const /home/xxx/data/git/llvm-project/clang/lib/Driver/Compilation.cpp:196:0
#71 0x000000000822b754 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const /home/xxx/data/git/llvm-project/clang/lib/Driver/Compilation.cpp:246:19
#72 0x0000000008266f77 llvm::SmallVectorBase<unsigned int>::empty() const /home/xxx/data/git/llvm-project/llvm/include/llvm/ADT/SmallVector.h:0:0
#73 0x0000000008266f77 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) /home/xxx/data/git/llvm-project/clang/lib/Driver/Driver.cpp:1509:0
#74 0x0000000000af95ae main /home/xxx/data/git/llvm-project/clang/tools/driver/driver.cpp:502:21
#75 0x00007f9ac3902b97 __libc_start_main /build/glibc-2ORdQG/glibc-2.27/csu/../csu/libc-start.c:344:0
#76 0x0000000000af38ea _start (/data/xxx/git/llvm-project/build/bin/clang+0xaf38ea)
clang-11: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 11.1.0 (https://github.com/llvm/llvm-project.git 1fdec59bffc11ae37eb51a1b9869f0696bfd5312)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /data/xxx/git/llvm-project/build/bin
clang-11: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-11: note: diagnostic msg: /tmp/test-397fa0.c
clang-11: note: diagnostic msg: /tmp/test-397fa0.sh
clang-11: note: diagnostic msg:

********************
Comment 1 Zhuo Zhang 2021-02-17 17:40:15 PST
Also affects trunk.
Comment 2 Zhuo Zhang 2021-02-18 06:42:39 PST
Assertion fails on trunk as well.

poc.c:3:41: warning: implicit declaration of function 'a' is invalid in C99 [-Wimplicit-function-declaration]
        int x __attribute__((aligned(({ a(); }))));
                                        ^
clang: /data/xxx/git/llvm-project/clang/lib/AST/Decl.cpp:2077: bool isDeclExternC(const T &) [T = clang::FunctionDecl]: Assertion `D.getASTContext().getLangOpts().CPlusPlus' failed.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: /data/xxx/git/llvm-project/build_12/bin/clang -x c -c poc.c
1.      poc.c:3:41: current parser token 'a'
2.      poc.c:1:12: parsing function body 'main'
3.      poc.c:1:12: in compound statement ('{}')
4.      poc.c:2:5: parsing struct/union body ''
5.      poc.c:3:39: in compound statement ('{}')
 #0 0x0000000000d89891 __interceptor_backtrace.part.117 (/data/xxx/git/llvm-project/build_12/bin/clang+0xd89891)
 #1 0x000000000d59d8da llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /data/xxx/git/llvm-project/llvm/lib/Support/Unix/Signals.inc:561:7
 #2 0x000000000d594061 llvm::sys::RunSignalHandlers() /data/xxx/git/llvm-project/llvm/lib/Support/Signals.cpp:72:18
 #3 0x000000000d59a4ff llvm::sys::CleanupOnSignal(unsigned long) /data/xxx/git/llvm-project/llvm/lib/Support/Unix/Signals.inc:0:3
 #4 0x000000000d2b2385 (anonymous namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long) /data/xxx/git/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:75:5
 #5 0x000000000d2b2e4c CrashRecoverySignalHandler(int) /data/xxx/git/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:389:1
 #6 0x00007fc41c8cd8a0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x128a0)
 #7 0x00007fc41c2f0f47 raise /build/glibc-2ORdQG/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
 #8 0x00007fc41c2f28b1 abort /build/glibc-2ORdQG/glibc-2.27/stdlib/abort.c:81:0
 #9 0x00007fc41c2e242a __assert_fail_base /build/glibc-2ORdQG/glibc-2.27/assert/assert.c:89:0
#10 0x00007fc41c2e24a2 (/lib/x86_64-linux-gnu/libc.so.6+0x304a2)
#11 0x000000001d00df7e /data/xxx/git/llvm-project/clang/lib/AST/Decl.cpp:2077:5
#12 0x0000000018ba57b5 bool isIncompleteDeclExternC<clang::FunctionDecl>(clang::Sema&, clang::FunctionDecl const*) /data/xxx/git/llvm-project/clang/lib/Sema/SemaDecl.cpp:6653:13
#13 0x0000000018b55bd5 clang::Sema::ActOnFunctionDeclarator(clang::Scope*, clang::Declarator&, clang::DeclContext*, clang::TypeSourceInfo*, clang::LookupResult&, llvm::MutableArrayRef<clang::TemplateParameterList*>, bool&) /data/xxx/git/llvm-project/clang/lib/Sema/SemaDecl.cpp:9773:7
#14 0x0000000018b3c18c clang::Sema::HandleDeclarator(clang::Scope*, clang::Declarator&, llvm::MutableArrayRef<clang::TemplateParameterList*>) /data/xxx/git/llvm-project/clang/lib/Sema/SemaDecl.cpp:5880:11
#15 0x0000000018b376db clang::Sema::ActOnDeclarator(clang::Scope*, clang::Declarator&) /data/xxx/git/llvm-project/clang/lib/Sema/SemaDecl.cpp:5556:15
#16 0x0000000018ac688c clang::Sema::ImplicitlyDefineFunction(clang::SourceLocation, clang::IdentifierInfo&, clang::Scope*) /data/xxx/git/llvm-project/clang/lib/Sema/SemaDecl.cpp:14782:41
#17 0x0000000018abe297 clang::Sema::ClassifyName(clang::Scope*, clang::CXXScopeSpec&, clang::IdentifierInfo*&, clang::SourceLocation, clang::Token const&, clang::CorrectionCandidateCallback*) /data/xxx/git/llvm-project/clang/lib/Sema/SemaDecl.cpp:927:26
#18 0x0000000017f7d855 clang::Parser::TryAnnotateName(clang::CorrectionCandidateCallback*) /data/xxx/git/llvm-project/clang/lib/Parse/Parser.cpp:1662:53
#19 0x0000000018293350 clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::Parser::ParsedAttributesWithRange&) /data/xxx/git/llvm-project/clang/lib/Parse/ParseStmt.cpp:191:11
#20 0x000000001829089a clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) /data/xxx/git/llvm-project/clang/lib/Parse/ParseStmt.cpp:106:20
#21 0x00000000182af9e5 clang::Parser::ParseCompoundStatementBody(bool) /data/xxx/git/llvm-project/clang/lib/Parse/ParseStmt.cpp:1099:11
#22 0x00000000182ac433 clang::Parser::ParseScope::~ParseScope() /data/xxx/git/llvm-project/clang/include/clang/Parse/Parser.h:0:0
#23 0x00000000182ac433 clang::Parser::ParseCompoundStatement(bool, unsigned int) /data/xxx/git/llvm-project/clang/lib/Parse/ParseStmt.cpp:910:0
#24 0x00000000180ed4ef clang::Parser::ParseParenExpression(clang::Parser::ParenParseOption&, bool, bool, clang::OpaquePtr<clang::QualType>&, clang::SourceLocation&) /data/xxx/git/llvm-project/clang/lib/Parse/ParseExpr.cpp:2827:23
#25 0x00000000180e5742 clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&, clang::Parser::TypeCastState, bool, bool*) /data/xxx/git/llvm-project/clang/lib/Parse/ParseExpr.cpp:957:11
#26 0x00000000180c5564 clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, clang::Parser::TypeCastState, bool, bool*) /data/xxx/git/llvm-project/clang/lib/Parse/ParseExpr.cpp:681:20
#27 0x00000000180c5564 clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) /data/xxx/git/llvm-project/clang/lib/Parse/ParseExpr.cpp:173:0
#28 0x0000000017fc7be6 clang::Parser::ParseAttributeArgsCommon(clang::IdentifierInfo*, clang::SourceLocation, clang::ParsedAttributes&, clang::SourceLocation*, clang::IdentifierInfo*, clang::SourceLocation, clang::AttributeCommonInfo::Syntax) /data/xxx/git/llvm-project/clang/lib/Parse/ParseDecl.cpp:398:47
#29 0x0000000017fc48b5 clang::Parser::ParseGNUAttributeArgs(clang::IdentifierInfo*, clang::SourceLocation, clang::ParsedAttributes&, clang::SourceLocation*, clang::IdentifierInfo*, clang::SourceLocation, clang::AttributeCommonInfo::Syntax, clang::Declarator*) /data/xxx/git/llvm-project/clang/lib/Parse/ParseDecl.cpp:485:3
#30 0x0000000017fc1e73 clang::Parser::ParseGNUAttributes(clang::ParsedAttributes&, clang::SourceLocation*, clang::Parser::LateParsedAttrList*, clang::Declarator*) /data/xxx/git/llvm-project/clang/lib/Parse/ParseDecl.cpp:190:9
#31 0x0000000017f913c3 clang::Parser::MaybeParseGNUAttributes(clang::Declarator&, clang::Parser::LateParsedAttrList*) /data/xxx/git/llvm-project/clang/include/clang/Parse/Parser.h:2665:31
#32 0x000000001801341e llvm::function_ref<void (clang::ParsingFieldDeclarator&)>::operator()(clang::ParsingFieldDeclarator&) const /data/xxx/git/llvm-project/llvm/include/llvm/ADT/STLExtras.h:0:0
#33 0x000000001801341e clang::Parser::ParseStructDeclaration(clang::ParsingDeclSpec&, llvm::function_ref<void (clang::ParsingFieldDeclarator&)>) /data/xxx/git/llvm-project/clang/lib/Parse/ParseDecl.cpp:4173:0
#34 0x000000001801575f clang::ParsingDeclSpec::~ParsingDeclSpec() /data/xxx/git/llvm-project/clang/include/clang/Parse/RAIIObjectsForParser.h:0:0
#35 0x000000001801575f clang::Parser::ParseStructUnionBody(clang::SourceLocation, clang::TypeSpecifierType, clang::RecordDecl*) /data/xxx/git/llvm-project/clang/lib/Parse/ParseDecl.cpp:4264:0
#36 0x000000001807c2cb clang::Parser::ParseClassSpecifier(clang::tok::TokenKind, clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext, clang::Parser::ParsedAttributesWithRange&) /data/xxx/git/llvm-project/clang/lib/Parse/ParseDeclCXX.cpp:1976:20
#37 0x0000000017fe2f27 clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*) /data/xxx/git/llvm-project/clang/lib/Parse/ParseDecl.cpp:3914:7
#38 0x0000000017fe0e49 clang::Parser::ParseSimpleDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&, bool, clang::Parser::ForRangeInit*, clang::SourceLocation*) /data/xxx/git/llvm-project/clang/lib/Parse/ParseDecl.cpp:1725:3
#39 0x0000000017fe043f clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&, clang::SourceLocation*) /data/xxx/git/llvm-project/clang/lib/Parse/ParseDecl.cpp:1687:12
#40 0x0000000018293d42 clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::Parser::ParsedAttributesWithRange&) /data/xxx/git/llvm-project/clang/lib/Parse/ParseStmt.cpp:0:16
#41 0x000000001829089a clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) /data/xxx/git/llvm-project/clang/lib/Parse/ParseStmt.cpp:106:20
#42 0x00000000182af9e5 clang::Parser::ParseCompoundStatementBody(bool) /data/xxx/git/llvm-project/clang/lib/Parse/ParseStmt.cpp:1099:11
#43 0x00000000182b580f clang::ActionResult<clang::Stmt*, true>::isInvalid() const /data/xxx/git/llvm-project/clang/include/clang/Sema/Ownership.h:0:0
#44 0x00000000182b580f clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) /data/xxx/git/llvm-project/clang/lib/Parse/ParseStmt.cpp:2263:0
#45 0x0000000017f77add clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) /data/xxx/git/llvm-project/clang/lib/Parse/Parser.cpp:0:10
#46 0x0000000017ff6aa0 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::SourceLocation*, clang::Parser::ForRangeInit*) /data/xxx/git/llvm-project/clang/lib/Parse/ParseDecl.cpp:1976:27
#47 0x0000000017f737b2 clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec&, clang::AccessSpecifier) /data/xxx/git/llvm-project/clang/lib/Parse/Parser.cpp:1134:10
#48 0x0000000017f705d7 clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*, clang::AccessSpecifier) /data/xxx/git/llvm-project/clang/lib/Parse/Parser.cpp:1150:12
#49 0x0000000017f6d3ad clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*) /data/xxx/git/llvm-project/clang/lib/Parse/Parser.cpp:0:12
#50 0x0000000017f662ee clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool) /data/xxx/git/llvm-project/clang/lib/Parse/Parser.cpp:716:10
#51 0x0000000017f647c8 clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) /data/xxx/git/llvm-project/clang/lib/Parse/Parser.cpp:588:26
#52 0x0000000017f529ab clang::ParseAST(clang::Sema&, bool, bool) /data/xxx/git/llvm-project/clang/lib/Parse/ParseAST.cpp:157:25
#53 0x00000000102ed733 clang::ASTFrontendAction::ExecuteAction() /data/xxx/git/llvm-project/clang/lib/Frontend/FrontendAction.cpp:1058:1
#54 0x00000000129dd448 clang::CodeGenAction::ExecuteAction() /data/xxx/git/llvm-project/clang/lib/CodeGen/CodeGenAction.cpp:1082:30
#55 0x00000000102ea56d clang::FrontendAction::Execute() /data/xxx/git/llvm-project/clang/lib/Frontend/FrontendAction.cpp:0:8
#56 0x00000000100f5a87 llvm::Error::operator bool() /data/xxx/git/llvm-project/llvm/include/llvm/Support/Error.h:0:0
#57 0x00000000100f5a87 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) /data/xxx/git/llvm-project/clang/lib/Frontend/CompilerInstance.cpp:949:0
#58 0x00000000107e829e clang::ExecuteCompilerInvocation(clang::CompilerInstance*) /data/xxx/git/llvm-project/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:278:25
#59 0x0000000000e277af cc1_main(llvm::ArrayRef<char const*>, char const*, void*) /data/xxx/git/llvm-project/clang/tools/driver/cc1_main.cpp:240:15
#60 0x0000000000e0f567 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) /data/xxx/git/llvm-project/clang/tools/driver/driver.cpp:330:12
#61 0x000000000fc7c44d clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, bool*) const::$_1::operator()() const /data/xxx/git/llvm-project/clang/lib/Driver/Job.cpp:404:30
#62 0x000000000fc7c44d void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, bool*) const::$_1>(long) /data/xxx/git/llvm-project/llvm/include/llvm/ADT/STLExtras.h:185:0
#63 0x000000000d2b1f24 llvm::function_ref<void ()>::operator()() const /data/xxx/git/llvm-project/llvm/include/llvm/ADT/STLExtras.h:209:12
#64 0x000000000d2b1f24 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) /data/xxx/git/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:424:0
#65 0x000000000fc79da2 clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, bool*) const /data/xxx/git/llvm-project/clang/lib/Driver/Job.cpp:404:7
#66 0x000000000fb7111e clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&) const /data/xxx/git/llvm-project/clang/lib/Driver/Compilation.cpp:195:15
#67 0x000000000fb71d6c clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const /data/xxx/git/llvm-project/clang/lib/Driver/Compilation.cpp:248:19
#68 0x000000000fbd4e2a llvm::SmallVectorBase<unsigned int>::empty() const /data/xxx/git/llvm-project/llvm/include/llvm/ADT/SmallVector.h:0:0
#69 0x000000000fbd4e2a clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) /data/xxx/git/llvm-project/clang/lib/Driver/Driver.cpp:1517:0
#70 0x0000000000e0c4af main /data/xxx/git/llvm-project/clang/tools/driver/driver.cpp:502:21
#71 0x00007fc41c2d3b97 __libc_start_main /build/glibc-2ORdQG/glibc-2.27/csu/../csu/libc-start.c:344:0
#72 0x0000000000d072ca _start (/data/xxx/git/llvm-project/build_12/bin/clang+0xd072ca)
clang-12: error: clang frontend command failed with exit code 134 (use -v to see invocation)
clang version 12.0.0 (https://github.com/llvm/llvm-project.git b46924ee5afe234526220c29a497794bf65f8f7f)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /data/xxx/git/llvm-project/build_12/bin
clang-12: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-12: note: diagnostic msg: /tmp/poc-edc185.c
clang-12: note: diagnostic msg: /tmp/poc-edc185.sh
clang-12: note: diagnostic msg:

********************
Comment 3 Zhuo Zhang 2021-02-18 15:07:16 PST
Sorry, I made a mistake of attaching the output of 12.0, instead of trunk. Following is the one of trunk.

test.c:3:41: warning: implicit declaration of function 'a' is invalid in C99 [-Wimplicit-function-declaration]
        int x __attribute__((aligned(({ a(); }))));
                                        ^
clang: /home/xxx/data/git/llvm-project/clang/lib/AST/Decl.cpp:2077: bool isDeclExternC(const T &) [T = clang::FunctionDecl]: Assertion `D.getASTContext().getLangOpts().CPlusPlus' failed.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: /data/xxx/git/llvm-project/build_trunk/bin/clang -x c -c test.c
1.      test.c:3:41: current parser token 'a'
2.      test.c:1:12: parsing function body 'main'
3.      test.c:1:12: in compound statement ('{}')
4.      test.c:2:5: parsing struct/union body ''
5.      test.c:3:39: in compound statement ('{}')
 #0 0x0000000000dfd0a1 __interceptor_backtrace.part.117 asan_interceptors.cc.o:0:0
 #1 0x000000000d7fb43a llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/xxx/data/git/llvm-project/llvm/lib/Support/Unix/Signals.inc:561:7
 #2 0x000000000d7f1bc1 llvm::sys::RunSignalHandlers() /home/xxx/data/git/llvm-project/llvm/lib/Support/Signals.cpp:72:18
 #3 0x000000000d7f805f llvm::sys::CleanupOnSignal(unsigned long) /home/xxx/data/git/llvm-project/llvm/lib/Support/Unix/Signals.inc:0:3
 #4 0x000000000d504245 (anonymous namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long) /home/xxx/data/git/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:75:5
 #5 0x000000000d504d0c CrashRecoverySignalHandler(int) /home/xxx/data/git/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:389:1
 #6 0x00007f35f0f918a0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x128a0)
 #7 0x00007f35f09b4f47 raise /build/glibc-2ORdQG/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
 #8 0x00007f35f09b68b1 abort /build/glibc-2ORdQG/glibc-2.27/stdlib/abort.c:81:0
 #9 0x00007f35f09a642a __assert_fail_base /build/glibc-2ORdQG/glibc-2.27/assert/assert.c:89:0
#10 0x00007f35f09a64a2 (/lib/x86_64-linux-gnu/libc.so.6+0x304a2)
#11 0x000000001d479b3e /home/xxx/data/git/llvm-project/clang/lib/AST/Decl.cpp:2077:5
#12 0x0000000018f645b5 bool isIncompleteDeclExternC<clang::FunctionDecl>(clang::Sema&, clang::FunctionDecl const*) /home/xxx/data/git/llvm-project/clang/lib/Sema/SemaDecl.cpp:6651:13
#13 0x0000000018f1470f clang::Sema::ActOnFunctionDeclarator(clang::Scope*, clang::Declarator&, clang::DeclContext*, clang::TypeSourceInfo*, clang::LookupResult&, llvm::MutableArrayRef<clang::TemplateParameterList*>, bool&) /home/xxx/data/git/llvm-project/clang/lib/Sema/SemaDecl.cpp:9777:7
#14 0x0000000018efab1c clang::Sema::HandleDeclarator(clang::Scope*, clang::Declarator&, llvm::MutableArrayRef<clang::TemplateParameterList*>) /home/xxx/data/git/llvm-project/clang/lib/Sema/SemaDecl.cpp:5878:11
#15 0x0000000018ef606b clang::Sema::ActOnDeclarator(clang::Scope*, clang::Declarator&) /home/xxx/data/git/llvm-project/clang/lib/Sema/SemaDecl.cpp:5554:15
#16 0x0000000018e85409 clang::Sema::ImplicitlyDefineFunction(clang::SourceLocation, clang::IdentifierInfo&, clang::Scope*) /home/xxx/data/git/llvm-project/clang/lib/Sema/SemaDecl.cpp:14786:41
#17 0x0000000018e7ce27 clang::Sema::ClassifyName(clang::Scope*, clang::CXXScopeSpec&, clang::IdentifierInfo*&, clang::SourceLocation, clang::Token const&, clang::CorrectionCandidateCallback*) /home/xxx/data/git/llvm-project/clang/lib/Sema/SemaDecl.cpp:927:26
#18 0x000000001832f4b5 clang::Parser::TryAnnotateName(clang::CorrectionCandidateCallback*) /home/xxx/data/git/llvm-project/clang/lib/Parse/Parser.cpp:1662:53
#19 0x00000000186466ae clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::Parser::ParsedAttributesWithRange&) /home/xxx/data/git/llvm-project/clang/lib/Parse/ParseStmt.cpp:198:11
#20 0x0000000018643e2a clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) /home/xxx/data/git/llvm-project/clang/lib/Parse/ParseStmt.cpp:115:3
#21 0x0000000018663e85 clang::Parser::ParseCompoundStatementBody(bool) /home/xxx/data/git/llvm-project/clang/lib/Parse/ParseStmt.cpp:1110:11
#22 0x00000000186608d3 clang::Parser::ParseScope::~ParseScope() /home/xxx/data/git/llvm-project/clang/include/clang/Parse/Parser.h:0:0
#23 0x00000000186608d3 clang::Parser::ParseCompoundStatement(bool, unsigned int) /home/xxx/data/git/llvm-project/clang/lib/Parse/ParseStmt.cpp:921:0
#24 0x000000001849f7ff clang::Parser::ParseParenExpression(clang::Parser::ParenParseOption&, bool, bool, clang::OpaquePtr<clang::QualType>&, clang::SourceLocation&) /home/xxx/data/git/llvm-project/clang/lib/Parse/ParseExpr.cpp:2827:23
#25 0x0000000018497a4c clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&, clang::Parser::TypeCastState, bool, bool*) /home/xxx/data/git/llvm-project/clang/lib/Parse/ParseExpr.cpp:957:11
#26 0x0000000018477884 clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, clang::Parser::TypeCastState, bool, bool*) /home/xxx/data/git/llvm-project/clang/lib/Parse/ParseExpr.cpp:681:20
#27 0x0000000018477884 clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) /home/xxx/data/git/llvm-project/clang/lib/Parse/ParseExpr.cpp:173:0
#28 0x0000000018379c06 clang::Parser::ParseAttributeArgsCommon(clang::IdentifierInfo*, clang::SourceLocation, clang::ParsedAttributes&, clang::SourceLocation*, clang::IdentifierInfo*, clang::SourceLocation, clang::AttributeCommonInfo::Syntax) /home/xxx/data/git/llvm-project/clang/lib/Parse/ParseDecl.cpp:416:47
#29 0x0000000018376898 clang::Parser::ParseGNUAttributeArgs(clang::IdentifierInfo*, clang::SourceLocation, clang::ParsedAttributes&, clang::SourceLocation*, clang::IdentifierInfo*, clang::SourceLocation, clang::AttributeCommonInfo::Syntax, clang::Declarator*) /home/xxx/data/git/llvm-project/clang/lib/Parse/ParseDecl.cpp:503:3
#30 0x0000000018373e53 clang::Parser::ParseGNUAttributes(clang::ParsedAttributes&, clang::SourceLocation*, clang::Parser::LateParsedAttrList*, clang::Declarator*) /home/xxx/data/git/llvm-project/clang/lib/Parse/ParseDecl.cpp:208:9
#31 0x0000000018343073 clang::Parser::MaybeParseGNUAttributes(clang::Declarator&, clang::Parser::LateParsedAttrList*) /home/xxx/data/git/llvm-project/clang/include/clang/Parse/Parser.h:2723:31
#32 0x00000000183c4fde llvm::function_ref<void (clang::ParsingFieldDeclarator&)>::operator()(clang::ParsingFieldDeclarator&) const /home/xxx/data/git/llvm-project/llvm/include/llvm/ADT/STLExtras.h:0:0
#33 0x00000000183c4fde clang::Parser::ParseStructDeclaration(clang::ParsingDeclSpec&, llvm::function_ref<void (clang::ParsingFieldDeclarator&)>) /home/xxx/data/git/llvm-project/clang/lib/Parse/ParseDecl.cpp:4187:0
#34 0x00000000183c7322 clang::ParsingDeclSpec::~ParsingDeclSpec() /home/xxx/data/git/llvm-project/clang/include/clang/Parse/RAIIObjectsForParser.h:0:0
#35 0x00000000183c7322 clang::Parser::ParseStructUnionBody(clang::SourceLocation, clang::TypeSpecifierType, clang::RecordDecl*) /home/xxx/data/git/llvm-project/clang/lib/Parse/ParseDecl.cpp:4278:0
#36 0x000000001842e535 clang::Parser::ParseClassSpecifier(clang::tok::TokenKind, clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext, clang::Parser::ParsedAttributesWithRange&) /home/xxx/data/git/llvm-project/clang/lib/Parse/ParseDeclCXX.cpp:1972:20
#37 0x0000000018394f87 clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*) /home/xxx/data/git/llvm-project/clang/lib/Parse/ParseDecl.cpp:3929:7
#38 0x0000000018392eac clang::Parser::ParseSimpleDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&, bool, clang::Parser::ForRangeInit*, clang::SourceLocation*) /home/xxx/data/git/llvm-project/clang/lib/Parse/ParseDecl.cpp:1743:3
#39 0x000000001839249f clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&, clang::SourceLocation*) /home/xxx/data/git/llvm-project/clang/lib/Parse/ParseDecl.cpp:1705:12
#40 0x0000000018647fa8 clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::Parser::ParsedAttributesWithRange&) /home/xxx/data/git/llvm-project/clang/lib/Parse/ParseStmt.cpp:0:16
#41 0x0000000018643e2a clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) /home/xxx/data/git/llvm-project/clang/lib/Parse/ParseStmt.cpp:115:3
#42 0x0000000018663e85 clang::Parser::ParseCompoundStatementBody(bool) /home/xxx/data/git/llvm-project/clang/lib/Parse/ParseStmt.cpp:1110:11
#43 0x0000000018669c9f clang::ActionResult<clang::Stmt*, true>::isInvalid() const /home/xxx/data/git/llvm-project/clang/include/clang/Sema/Ownership.h:0:0
#44 0x0000000018669c9f clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) /home/xxx/data/git/llvm-project/clang/lib/Parse/ParseStmt.cpp:2274:0
#45 0x000000001832973d clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) /home/xxx/data/git/llvm-project/clang/lib/Parse/Parser.cpp:0:10
#46 0x00000000183a8a06 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::SourceLocation*, clang::Parser::ForRangeInit*) /home/xxx/data/git/llvm-project/clang/lib/Parse/ParseDecl.cpp:1994:27
#47 0x0000000018325412 clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec&, clang::AccessSpecifier) /home/xxx/data/git/llvm-project/clang/lib/Parse/Parser.cpp:1134:10
#48 0x0000000018322237 clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*, clang::AccessSpecifier) /home/xxx/data/git/llvm-project/clang/lib/Parse/Parser.cpp:1150:12
#49 0x000000001831f00d clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*) /home/xxx/data/git/llvm-project/clang/lib/Parse/Parser.cpp:0:12
#50 0x0000000018317f4e clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool) /home/xxx/data/git/llvm-project/clang/lib/Parse/Parser.cpp:716:10
#51 0x0000000018316428 clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) /home/xxx/data/git/llvm-project/clang/lib/Parse/Parser.cpp:588:26
#52 0x000000001830460b clang::ParseAST(clang::Sema&, bool, bool) /home/xxx/data/git/llvm-project/clang/lib/Parse/ParseAST.cpp:157:25
#53 0x00000000105c90c3 clang::ASTFrontendAction::ExecuteAction() /home/xxx/data/git/llvm-project/clang/lib/Frontend/FrontendAction.cpp:1058:1
#54 0x0000000012cff7d9 clang::CodeGenAction::ExecuteAction() /home/xxx/data/git/llvm-project/clang/lib/CodeGen/CodeGenAction.cpp:1082:30
#55 0x00000000105c5efd clang::FrontendAction::Execute() /home/xxx/data/git/llvm-project/clang/lib/Frontend/FrontendAction.cpp:0:8
#56 0x0000000010394e0a llvm::Error::operator bool() /home/xxx/data/git/llvm-project/llvm/include/llvm/Support/Error.h:0:0
#57 0x0000000010394e0a clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) /home/xxx/data/git/llvm-project/clang/lib/Frontend/CompilerInstance.cpp:949:0
#58 0x0000000010ac5a2e clang::ExecuteCompilerInvocation(clang::CompilerInstance*) /home/xxx/data/git/llvm-project/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:278:25
#59 0x0000000000e9b85d cc1_main(llvm::ArrayRef<char const*>, char const*, void*) /home/xxx/data/git/llvm-project/clang/tools/driver/cc1_main.cpp:246:15
#60 0x0000000000e82e17 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) /home/xxx/data/git/llvm-project/clang/tools/driver/driver.cpp:330:12
#61 0x000000000ff0a39d clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, bool*) const::$_1::operator()() const /home/xxx/data/git/llvm-project/clang/lib/Driver/Job.cpp:404:30
#62 0x000000000ff0a39d void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, bool*) const::$_1>(long) /home/xxx/data/git/llvm-project/llvm/include/llvm/ADT/STLExtras.h:185:0
#63 0x000000000d503de4 llvm::function_ref<void ()>::operator()() const /home/xxx/data/git/llvm-project/llvm/include/llvm/ADT/STLExtras.h:209:12
#64 0x000000000d503de4 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) /home/xxx/data/git/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:424:0
#65 0x000000000ff08be2 clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, bool*) const /home/xxx/data/git/llvm-project/clang/lib/Driver/Job.cpp:404:7
#66 0x000000000fdfc32e clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&) const /home/xxx/data/git/llvm-project/clang/lib/Driver/Compilation.cpp:195:15
#67 0x000000000fdfcf7c clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const /home/xxx/data/git/llvm-project/clang/lib/Driver/Compilation.cpp:248:19
#68 0x000000000fe6126a llvm::SmallVectorBase<unsigned int>::empty() const /home/xxx/data/git/llvm-project/llvm/include/llvm/ADT/SmallVector.h:0:0
#69 0x000000000fe6126a clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) /home/xxx/data/git/llvm-project/clang/lib/Driver/Driver.cpp:1529:0
#70 0x0000000000e7fd4f main /home/xxx/data/git/llvm-project/clang/tools/driver/driver.cpp:502:21
#71 0x00007f35f0997b97 __libc_start_main /build/glibc-2ORdQG/glibc-2.27/csu/../csu/libc-start.c:344:0
#72 0x0000000000d7aada _start (/data/xxx/git/llvm-project/build_trunk/bin/clang+0xd7aada)
clang-13: error: clang frontend command failed with exit code 134 (use -v to see invocation)
clang version 13.0.0 (https://github.com/llvm/llvm-project.git b006902b2dfac792e8ade73798ca1b216654faf7)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /data/xxx/git/llvm-project/build_trunk/bin
clang-13: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-13: note: diagnostic msg: /tmp/test-0b4587.c
clang-13: note: diagnostic msg: /tmp/test-0b4587.sh
clang-13: note: diagnostic msg:

********************