Skip to content

[Flang][OpenMP] crashes when using task private with character pointer/allocatable #142365

@k-arrows

Description

@k-arrows

Reproducer:
https://godbolt.org/z/EEo3Y7Kee

character(:), pointer :: c1
character(:), allocatable :: c2
!$omp task private(c1, c2)
!$omp end task
end

Backtrace:

flang-21: warning: OpenMP support in flang is still experimental [-Wexperimental-option]
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.	Program arguments: /opt/compiler-explorer/clang-llvmflang-trunk-20250601/bin/flang -fc1 -triple x86_64-unknown-linux-gnu -S -mrelocation-model pic -pic-level 2 -pic-is-pie -target-cpu x86-64 -mllvm -x86-asm-syntax=intel -fopenmp -resource-dir /opt/compiler-explorer/clang-llvmflang-trunk-20250601/lib/clang/21 -mframe-pointer=all -o /app/output.s -x f95 /app/example.f90
 #0 0x0000000003e95aa8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-llvmflang-trunk-20250601/bin/flang+0x3e95aa8)
 #1 0x0000000003e93664 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #2 0x00007365f9e42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #3 0x000000000223afbc llvm::IRBuilderBase::SetInsertPoint(llvm::Instruction*) (/opt/compiler-explorer/clang-llvmflang-trunk-20250601/bin/flang+0x223afbc)
 #4 0x0000000005bec172 convertOmpTaskOp(mlir::omp::TaskOp, llvm::IRBuilderBase&, mlir::LLVM::ModuleTranslation&) OpenMPToLLVMIRTranslation.cpp:0:0
 #5 0x0000000005bf0cd3 convertHostOrTargetOperation(mlir::Operation*, llvm::IRBuilderBase&, mlir::LLVM::ModuleTranslation&) OpenMPToLLVMIRTranslation.cpp:0:0
 #6 0x0000000005bf2695 (anonymous namespace)::OpenMPDialectLLVMIRTranslationInterface::convertOperation(mlir::Operation*, llvm::IRBuilderBase&, mlir::LLVM::ModuleTranslation&) const OpenMPToLLVMIRTranslation.cpp:0:0
 #7 0x000000000758e7c6 mlir::LLVM::ModuleTranslation::convertOperation(mlir::Operation&, llvm::IRBuilderBase&, bool) (/opt/compiler-explorer/clang-llvmflang-trunk-20250601/bin/flang+0x758e7c6)
 #8 0x000000000758ec0c mlir::LLVM::ModuleTranslation::convertBlockImpl(mlir::Block&, bool, llvm::IRBuilderBase&, bool) (/opt/compiler-explorer/clang-llvmflang-trunk-20250601/bin/flang+0x758ec0c)
 #9 0x00000000075946b7 mlir::LLVM::ModuleTranslation::convertOneFunction(mlir::LLVM::LLVMFuncOp) (/opt/compiler-explorer/clang-llvmflang-trunk-20250601/bin/flang+0x75946b7)
#10 0x0000000007595e18 mlir::LLVM::ModuleTranslation::convertFunctions() (/opt/compiler-explorer/clang-llvmflang-trunk-20250601/bin/flang+0x7595e18)
#11 0x000000000759e2ae mlir::translateModuleToLLVMIR(mlir::Operation*, llvm::LLVMContext&, llvm::StringRef, bool) (/opt/compiler-explorer/clang-llvmflang-trunk-20250601/bin/flang+0x759e2ae)
#12 0x00000000041a296f Fortran::frontend::CodeGenAction::generateLLVMIR() (/opt/compiler-explorer/clang-llvmflang-trunk-20250601/bin/flang+0x41a296f)
#13 0x00000000041a7b18 Fortran::frontend::CodeGenAction::executeAction() (/opt/compiler-explorer/clang-llvmflang-trunk-20250601/bin/flang+0x41a7b18)
#14 0x0000000003eed9cd Fortran::frontend::FrontendAction::execute() (/opt/compiler-explorer/clang-llvmflang-trunk-20250601/bin/flang+0x3eed9cd)
#15 0x0000000003edbb08 Fortran::frontend::CompilerInstance::executeAction(Fortran::frontend::FrontendAction&) (/opt/compiler-explorer/clang-llvmflang-trunk-20250601/bin/flang+0x3edbb08)
#16 0x0000000003ef6913 Fortran::frontend::executeCompilerInvocation(Fortran::frontend::CompilerInstance*) (/opt/compiler-explorer/clang-llvmflang-trunk-20250601/bin/flang+0x3ef6913)
#17 0x00000000021fae1a fc1_main(llvm::ArrayRef<char const*>, char const*) (/opt/compiler-explorer/clang-llvmflang-trunk-20250601/bin/flang+0x21fae1a)
#18 0x00000000020b16ef main (/opt/compiler-explorer/clang-llvmflang-trunk-20250601/bin/flang+0x20b16ef)
#19 0x00007365f9e29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#20 0x00007365f9e29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#21 0x00000000021f97e5 _start (/opt/compiler-explorer/clang-llvmflang-trunk-20250601/bin/flang+0x21f97e5)
flang-21: error: unable to execute command: Segmentation fault (core dumped)
flang-21: error: flang frontend command failed due to signal (use -v to see invocation)
flang version 21.0.0git (https://github.com/llvm/llvm-project.git fbb22ce1aae919606f2db81255b8e054c949783c)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/compiler-explorer/clang-llvmflang-trunk-20250601/bin
flang-21: warning: OpenMP support in flang is still experimental [-Wexperimental-option]
flang-21: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
flang-21: note: diagnostic msg: /tmp/example-51155c
flang-21: note: diagnostic msg: /tmp/example-51155c.sh
flang-21: note: diagnostic msg: 

********************
Compiler returned: 254

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions