-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Closed
Labels
crashPrefer [crash-on-valid] or [crash-on-invalid]Prefer [crash-on-valid] or [crash-on-invalid]flang:irflang:openmp
Description
Version of flang : 22.0.0(a5cf82c645245c4f6ed3dcc2178b8abfeed0f7d5)/AArch64
When CHARACTER variable (ch1) with POINTER attribute is specified as an argument of MAX intrinsic function and the function's result is assigned to that variable (ch1), the compilation terminate abnormally.
This seems to be similar to the issue below.
#85596
#85596 is closed.
The only difference from #85596 is whether POINTER attribute is specified.
The program in this issue has POINTER attribute.
Compilation terminates normally in the following cases:
-fopenmpoption is not specified, or- Change
CHARACTERtype toINTEGERorREAL
The following are the test program, Flang, Gfortran and ifx compilation/execution results.
sngtatm030_23.f90:
program main
character(1),pointer::ch1
allocate(character(1)::ch1)
ch1="a"
!$omp parallel
!$omp atomic
ch1 = max(ch1,"z")
!$omp end parallel
write(6,*) "ch1 = ", ch1
end program main$ flang -fopenmp sngtatm030_23.f90
error: loc("/work/home/ohno/CT/test/fort/tp/reproducerJ/openmp3.1_01/sngtatm030_23.f90":6:7): character buffer should be in CharBoxValue
LLVM ERROR: aborting
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: /work/groups/ssoft/compiler/llvm/aarch64/main-20250825-a5cf82c64524/bin/flang -fc1 -triple aarch64-unknown-linux-gnu -emit-obj -mrelocation-model pic -pic-level 2 -pic-is-pie -target-cpu generic -target-feature
+outline-atomics -target-feature +v8a -target-feature +fp-armv8 -target-feature +neon -fopenmp -resource-dir /work/groups/ssoft/compiler/llvm/aarch64/main-20250825-a5cf82c64524/lib/clang/22 -mframe-pointer=non-leaf -o /tmp/sngtatm030_23
-f85613.o -x f95 sngtatm030_23.f90
#0 0x000040001629d9e8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/work/groups/ssoft/compiler/llvm/aarch64/main-latest/lib/libLLVM.so.22.0git+0x5bdd9e8)
#1 0x000040001629af90 llvm::sys::RunSignalHandlers() (/work/groups/ssoft/compiler/llvm/aarch64/main-latest/lib/libLLVM.so.22.0git+0x5bdaf90)
#2 0x000040001629b0e8 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#3 0x0000400004e707a0 (linux-vdso.so.1+0x7a0)
#4 0x000040001b2c6274 raise (/lib64/libc.so.6+0x36274)
#5 0x000040001b2b0a2c abort (/lib64/libc.so.6+0x20a2c)
#6 0x00004000161c0044 (/work/groups/ssoft/compiler/llvm/aarch64/main-latest/lib/libLLVM.so.22.0git+0x5b00044)
#7 0x00004000161c00a4 (/work/groups/ssoft/compiler/llvm/aarch64/main-latest/lib/libLLVM.so.22.0git+0x5b000a4)
#8 0x00000000057cd55c fir::emitFatalError(mlir::Location, llvm::Twine const&, bool) Bridge.cpp:0:0
#9 0x0000000005b6f21c genAtomicUpdate(Fortran::lower::AbstractConverter&, Fortran::semantics::SemanticsContext&, mlir::Location, Fortran::lower::StatementContext&, mlir::Value, Fortran::evaluate::Expr<Fortran::evaluate::SomeType> const&
, Fortran::evaluate::Assignment const&, mlir::IntegerAttr, std::optional<mlir::omp::ClauseMemoryOrderKind>, mlir::OpBuilder::InsertPoint, mlir::OpBuilder::InsertPoint, mlir::OpBuilder::InsertPoint) (.isra.7894) Atomic.cpp:0:0
#10 0x0000000005b6f814 genAtomicOperation(Fortran::lower::AbstractConverter&, Fortran::semantics::SemanticsContext&, mlir::Location, Fortran::lower::StatementContext&, int, mlir::Value, Fortran::evaluate::Expr<Fortran::evaluate::SomeType
> const&, Fortran::evaluate::Assignment const&, mlir::IntegerAttr, std::optional<mlir::omp::ClauseMemoryOrderKind>, mlir::OpBuilder::InsertPoint, mlir::OpBuilder::InsertPoint, mlir::OpBuilder::InsertPoint) (.isra.7895) Atomic.cpp:0:0
#11 0x0000000005b700d0 Fortran::lower::omp::lowerAtomic(Fortran::lower::AbstractConverter&, Fortran::lower::SymMap&, Fortran::semantics::SemanticsContext&, Fortran::lower::pft::Evaluation&, Fortran::parser::OpenMPAtomicConstruct const&)
(/work/groups/ssoft/compiler/llvm/aarch64/main-20250825-a5cf82c64524/bin/flang+0x5b700d0)
#12 0x0000000005b36a84 Fortran::lower::genOpenMPConstruct(Fortran::lower::AbstractConverter&, Fortran::lower::SymMap&, Fortran::semantics::SemanticsContext&, Fortran::lower::pft::Evaluation&, Fortran::parser::OpenMPConstruct const&) (/wo
rk/groups/ssoft/compiler/llvm/aarch64/main-20250825-a5cf82c64524/bin/flang+0x5b36a84)
- omitted -
#22 0x00000000057f8b4c (anonymous namespace)::FirConverter::lowerFunc(Fortran::lower::pft::FunctionLikeUnit&) Bridge.cpp:0:0
#23 0x00000000057faa7c Fortran::lower::LoweringBridge::lower(Fortran::parser::Program const&, Fortran::semantics::SemanticsContext const&) (/work/groups/ssoft/compiler/llvm/aarch64/main-20250825-a5cf82c64524/bin/flang+0x57faa7c)
#24 0x00000000056c2b60 Fortran::frontend::CodeGenAction::beginSourceFileAction() (/work/groups/ssoft/compiler/llvm/aarch64/main-20250825-a5cf82c64524/bin/flang+0x56c2b60)
#25 0x00000000056b1704 Fortran::frontend::FrontendAction::beginSourceFile(Fortran::frontend::CompilerInstance&, Fortran::frontend::FrontendInputFile const&) (/work/groups/ssoft/compiler/llvm/aarch64/main-20250825-a5cf82c64524/bin/flang+0
x56b1704)
#26 0x000000000569e51c Fortran::frontend::CompilerInstance::executeAction(Fortran::frontend::FrontendAction&) (/work/groups/ssoft/compiler/llvm/aarch64/main-20250825-a5cf82c64524/bin/flang+0x569e51c)
#27 0x00000000056b690c Fortran::frontend::executeCompilerInvocation(Fortran::frontend::CompilerInstance*) (/work/groups/ssoft/compiler/llvm/aarch64/main-20250825-a5cf82c64524/bin/flang+0x56b690c)
#28 0x0000000005696bd0 fc1_main(llvm::ArrayRef<char const*>, char const*) (/work/groups/ssoft/compiler/llvm/aarch64/main-20250825-a5cf82c64524/bin/flang+0x5696bd0)
#29 0x00000000056965c4 main (/work/groups/ssoft/compiler/llvm/aarch64/main-20250825-a5cf82c64524/bin/flang+0x56965c4)
#30 0x000040001b2b4384 __libc_start_main (/lib64/libc.so.6+0x24384)
#31 0x0000000005694a64 _start (/work/groups/ssoft/compiler/llvm/aarch64/main-20250825-a5cf82c64524/bin/flang+0x5694a64)
flang-22: error: unable to execute command: Aborted (core dumped)
flang-22: error: flang frontend command failed due to signal (use -v to see invocation)
flang version 22.0.0git (https://github.com/llvm/llvm-project.git a5cf82c645245c4f6ed3dcc2178b8abfeed0f7d5)
Target: aarch64-unknown-linux-gnu
Thread model: posix
InstalledDir: /work/groups/ssoft/compiler/llvm/aarch64/main-20250825-a5cf82c64524/bin
Build config: +assertions
flang-22: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
flang-22: note: diagnostic msg: /tmp/sngtatm030_23-c7dd9d
flang-22: note: diagnostic msg: /tmp/sngtatm030_23-c7dd9d.sh
flang-22: note: diagnostic msg:
********************
$
$ cat /tmp/sngtatm030_23-c7dd9d
#line "./sngtatm030_23.f90" 1
program main
character(1),pointer::ch1
allocate(character(1)::ch1)
ch1="a"
!$omp parallel
!$omp atomic
ch1 = max(ch1,"z")
!$omp end parallel
write(6,*) "ch1 = ", ch1
end program main
$
$ cat /tmp/sngtatm030_23-c7dd9d.sh
# Crash reproducer for clang version 22.0.0git (https://github.com/llvm/llvm-project.git a5cf82c645245c4f6ed3dcc2178b8abfeed0f7d5)
# Driver args: "-fopenmp" "sngtatm030_23.f90"
# Original command: "/work/groups/ssoft/compiler/llvm/aarch64/main-20250825-a5cf82c64524/bin/flang" "-fc1" "-triple" "aarch64-unknown-linux-gnu" "-emit-obj" "-mrelocation-model" "pic" "-pic-level" "2" "-pic-is-pie" "-target-cpu" "generi
c" "-target-feature" "+outline-atomics" "-target-feature" "+v8a" "-target-feature" "+fp-armv8" "-target-feature" "+neon" "-fopenmp" "-resource-dir" "/work/groups/ssoft/compiler/llvm/aarch64/main-20250825-a5cf82c64524/lib/clang/22" "-mfra
me-pointer=non-leaf" "-o" "/tmp/sngtatm030_23-f85613.o" "-x" "f95" "sngtatm030_23.f90"
"/work/groups/ssoft/compiler/llvm/aarch64/main-20250825-a5cf82c64524/bin/flang" "-fc1" "-triple" "aarch64-unknown-linux-gnu" "-emit-obj" "-mrelocation-model" "pic" "-pic-level" "2" "-pic-is-pie" "-target-cpu" "generic" "-target-feature"
"+outline-atomics" "-target-feature" "+v8a" "-target-feature" "+fp-armv8" "-target-feature" "+neon" "-fopenmp" "-mframe-pointer=non-leaf" "-x" "f95" "sngtatm030_23-c7dd9d"
$
$ gfortran -fopenmp sngtatm030_23.f90
sngtatm030_23.f90:7:2:
7 | ch1 = max(ch1,"z")
| 1
Error: !$OMP ATOMIC statement must set a scalar variable of intrinsic type at (1)
$
$ export OMP_NUM_THREADS=2; ifx -qopenmp sngtatm030_23.f90; ./a.out
ch1 = z
$
Metadata
Metadata
Assignees
Labels
crashPrefer [crash-on-valid] or [crash-on-invalid]Prefer [crash-on-valid] or [crash-on-invalid]flang:irflang:openmp
Type
Projects
Status
Done