Open
Description
Clang-19 crashed with #pragma omp atomic
enabled.
Compiler explorer(assertion trunck): https://godbolt.org/z/W9ePrb8cK
$cat mutant.C
a() {
#pragma omp atomic
0 --
This program was reduced by Creduce.
$clang-19 -fopenmp mutant.C
mutant.C:1:1: error: a type specifier is required for all declarations
1 | a() {
| ^
mutant.C:3:5: error: expression is not assignable
3 | 0 --
| ~ ^
mutant.C:3:7: error: expected ';' after expression
3 | 0 --
| ^
| ;
mutant.C:3:3: error: the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an lvalue expression with scalar type
3 | 0 --
| ^~~~
clang-19: /home/compiler/llvm/clang/lib/Basic/Diagnostic.cpp:620: void HandleSelectModifier(const Diagnostic &, unsigned int, const char *, unsigned int, SmallVectorImpl<char> &): Assertion `NextVal != ArgumentEnd && "Value for integer select modifier was" " larger than the number of options in the diagnostic string!"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: /home/software/llvm-trunk-eed7c5e/bin/clang-19 -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -dumpdir a- -disable-free -clear-ast-before-backend -main-file-name mutant.C -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/home/code/reduce -fcoverage-compilation-dir=/home/code/reduce -resource-dir /home/software/llvm-trunk-eed7c5e/lib/clang/19 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/x86_64-linux-gnu/c++/11 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/backward -internal-isystem /home/software/llvm-trunk-eed7c5e/lib/clang/19/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/11/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdeprecated-macro -ferror-limit 19 -fopenmp -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fcxx-exceptions -fexceptions -fcolor-diagnostics -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/mutant-4ab162.o -x c++ mutant.C
1. <eof> parser at end of file
2. mutant.C:1:5: parsing function body 'a'
3. mutant.C:1:5: in compound statement ('{}')
#0 0x00007fa5ac905617 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/software/llvm-trunk-eed7c5e/bin/../lib/libLLVM.so.19.0git+0xffc617)
#1 0x00007fa5ac901b92 llvm::sys::RunSignalHandlers() (/home/software/llvm-trunk-eed7c5e/bin/../lib/libLLVM.so.19.0git+0xff8b92)
#2 0x00007fa5ac905d91 SignalHandler(int) Signals.cpp:0:0
#3 0x00007fa5ab3e9520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x00007fa5ab43d9fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#5 0x00007fa5ab3e9476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#6 0x00007fa5ab3cf7f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#7 0x00007fa5ab3cf71b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
#8 0x00007fa5ab3e0e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#9 0x00007fa5c5e3f310 clang::Diagnostic::FormatDiagnostic(char const*, char const*, llvm::SmallVectorImpl<char>&) const (/home/software/llvm-trunk-eed7c5e/bin/../lib/libclang-cpp.so.19.0git+0xb18310)
#10 0x00007fa5caafbca3 clang::TextDiagnosticPrinter::HandleDiagnostic(clang::DiagnosticsEngine::Level, clang::Diagnostic const&) (/home/software/llvm-trunk-eed7c5e/bin/../lib/libclang-cpp.so.19.0git+0x57d4ca3)
#11 0x00007fa5c5e4a9aa clang::DiagnosticIDs::EmitDiag(clang::DiagnosticsEngine&, clang::DiagnosticIDs::Level) const (/home/software/llvm-trunk-eed7c5e/bin/../lib/libclang-cpp.so.19.0git+0xb239aa)
#12 0x00007fa5c5e4a694 clang::DiagnosticIDs::ProcessDiag(clang::DiagnosticsEngine&) const (/home/software/llvm-trunk-eed7c5e/bin/../lib/libclang-cpp.so.19.0git+0xb23694)
#13 0x00007fa5c5e3cbeb clang::DiagnosticsEngine::EmitCurrentDiagnostic(bool) (/home/software/llvm-trunk-eed7c5e/bin/../lib/libclang-cpp.so.19.0git+0xb15beb)
#14 0x00007fa5c7542db8 clang::Sema::EmitCurrentDiagnostic(unsigned int) (/home/software/llvm-trunk-eed7c5e/bin/../lib/libclang-cpp.so.19.0git+0x221bdb8)
#15 0x00007fa5c76dc064 clang::SemaBase::ImmediateDiagBuilder::~ImmediateDiagBuilder() (/home/software/llvm-trunk-eed7c5e/bin/../lib/libclang-cpp.so.19.0git+0x23b5064)
#16 0x00007fa5c75447ed clang::SemaBase::SemaDiagnosticBuilder::~SemaDiagnosticBuilder() (/home/software/llvm-trunk-eed7c5e/bin/../lib/libclang-cpp.so.19.0git+0x221d7ed)
#17 0x00007fa5c8253416 (anonymous namespace)::OpenMPAtomicUpdateChecker::checkStatement(clang::Stmt*, unsigned int, unsigned int) SemaOpenMP.cpp:0:0
#18 0x00007fa5c8233326 clang::SemaOpenMP::ActOnOpenMPAtomicDirective(llvm::ArrayRef<clang::OMPClause*>, clang::Stmt*, clang::SourceLocation, clang::SourceLocation) (/home/software/llvm-trunk-eed7c5e/bin/../lib/libclang-cpp.so.19.0git+0x2f0c326)
#19 0x00007fa5c821964e clang::SemaOpenMP::ActOnOpenMPExecutableDirective(llvm::omp::Directive, clang::DeclarationNameInfo const&, llvm::omp::Directive, llvm::ArrayRef<clang::OMPClause*>, clang::Stmt*, clang::SourceLocation, clang::SourceLocation, llvm::omp::Directive) (/home/software/llvm-trunk-eed7c5e/bin/../lib/libclang-cpp.so.19.0git+0x2ef264e)
#20 0x00007fa5c628ab68 clang::Parser::ParseOpenMPExecutableDirective(clang::Parser::ParsedStmtContext, llvm::omp::Directive, clang::SourceLocation, bool) (/home/software/llvm-trunk-eed7c5e/bin/../lib/libclang-cpp.so.19.0git+0xf63b68)
#21 0x00007fa5c628b419 clang::Parser::ParseOpenMPDeclarativeOrExecutableDirective(clang::Parser::ParsedStmtContext, bool) (/home/software/llvm-trunk-eed7c5e/bin/../lib/libclang-cpp.so.19.0git+0xf64419)
#22 0x00007fa5c62cf0dc clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributes&, clang::ParsedAttributes&) (/home/software/llvm-trunk-eed7c5e/bin/../lib/libclang-cpp.so.19.0git+0xfa80dc)
#23 0x00007fa5c62cd766 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (/home/software/llvm-trunk-eed7c5e/bin/../lib/libclang-cpp.so.19.0git+0xfa6766)
#24 0x00007fa5c62dbffd clang::Parser::ParseCompoundStatementBody(bool) (/home/software/llvm-trunk-eed7c5e/bin/../lib/libclang-cpp.so.19.0git+0xfb4ffd)
#25 0x00007fa5c62de0b5 clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (/home/software/llvm-trunk-eed7c5e/bin/../lib/libclang-cpp.so.19.0git+0xfb70b5)
#26 0x00007fa5c630fd7b clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) (/home/software/llvm-trunk-eed7c5e/bin/../lib/libclang-cpp.so.19.0git+0xfe8d7b)
#27 0x00007fa5c61abfed clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::ParsedAttributes&, clang::Parser::ParsedTemplateInfo&, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/home/software/llvm-trunk-eed7c5e/bin/../lib/libclang-cpp.so.19.0git+0xe84fed)
#28 0x00007fa5c630e27d clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/home/software/llvm-trunk-eed7c5e/bin/../lib/libclang-cpp.so.19.0git+0xfe727d)
#29 0x00007fa5c630d4b3 clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/home/software/llvm-trunk-eed7c5e/bin/../lib/libclang-cpp.so.19.0git+0xfe64b3)
#30 0x00007fa5c630bfb1 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/home/software/llvm-trunk-eed7c5e/bin/../lib/libclang-cpp.so.19.0git+0xfe4fb1)
#31 0x00007fa5c630906e clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/home/software/llvm-trunk-eed7c5e/bin/../lib/libclang-cpp.so.19.0git+0xfe206e)
#32 0x00007fa5c6308626 clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/home/software/llvm-trunk-eed7c5e/bin/../lib/libclang-cpp.so.19.0git+0xfe1626)
#33 0x00007fa5c6181fce clang::ParseAST(clang::Sema&, bool, bool) (/home/software/llvm-trunk-eed7c5e/bin/../lib/libclang-cpp.so.19.0git+0xe5afce)
#34 0x00007fa5caa6aed5 clang::FrontendAction::Execute() (/home/software/llvm-trunk-eed7c5e/bin/../lib/libclang-cpp.so.19.0git+0x5743ed5)
#35 0x00007fa5ca923cbb clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/home/software/llvm-trunk-eed7c5e/bin/../lib/libclang-cpp.so.19.0git+0x55fccbb)
#36 0x00007fa5cab6bfd1 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/home/software/llvm-trunk-eed7c5e/bin/../lib/libclang-cpp.so.19.0git+0x5844fd1)
#37 0x0000557741dd71bf cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/home/software/llvm-trunk-eed7c5e/bin/clang-19+0x1d1bf)
#38 0x0000557741dcca94 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#39 0x0000557741dcb2b5 clang_main(int, char**, llvm::ToolContext const&) (/home/software/llvm-trunk-eed7c5e/bin/clang-19+0x112b5)
#40 0x0000557741df3e25 main (/home/software/llvm-trunk-eed7c5e/bin/clang-19+0x39e25)
#41 0x00007fa5ab3d0d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#42 0x00007fa5ab3d0e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#43 0x0000557741dc86d5 _start (/home/software/llvm-trunk-eed7c5e/bin/clang-19+0xe6d5)
clang: error: unable to execute command: Aborted (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 19.0.0git (https://github.com/llvm/llvm-project.git eed7c5e29c1dc5f78bd01608430e2b4e0c439bb1)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/software/llvm-trunk-eed7c5e/bin
Build config: +assertions
clang: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/mutant-b1904a.cpp
clang: note: diagnostic msg: /tmp/mutant-b1904a.sh
clang: note: diagnostic msg:
********************
Metadata
Metadata
Assignees
Labels
Language frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"OpenMP related changes to ClangOpenMP related changes to ClangVerified by a second partyVerified by a second party