| Issue |
87955
|
| Summary |
[Flang][OpenMP] Compilation error of using a reduction clause (min) with a variable (kind=16)
|
| Labels |
openmp,
flang
|
| Assignees |
|
| Reporter |
ohno-fj
|
```
Version of flang-new : 19.0.0(cbcdf126ccc774c063b5d5140c1393ff5305dded)/AArch64
```
A compilation error occurs when using a `reduction` clause (`min`) with a variable (`kind=16`).
The same error occurs when `max` intrinsic function is used.
Compilation terminates normally in the following cases:
- change `kind=16` to `kind=8`
- remove `reduction` clause (`min`)
- compile without `-fopenmp` option
The following are the test program, Flang-new, Gfortran and ifort compilation/execution result.
snfmm235_3.f90:
```fortran
program main
real(kind=16) r3/1/
!$omp parallel reduction(min:r3)
r3=min(r3,1.0_16)
write(6,*) "r3 = ", r3
if (r3 < 1.0_16) then
r3 = 1.0_16
end if
!$omp end parallel
write(6,*) "pass"
end program main
```
```
$ flang-new -fopenmp snfmm235_3.f90
LLVM ERROR: Cannot select: t7: f128 = fminimum contract t4, t6
t4: f128,ch = load<(dereferenceable load (s128) from @_QFEr3)> t0, t41, undef:i64
t41: i64 = AArch64ISD::ADDlow t40, TargetGlobalAddress:i64<ptr @_QFEr3> 0 [TF=34]
t40: i64 = AArch64ISD::ADRP TargetGlobalAddress:i64<ptr @_QFEr3> 0 [TF=1]
t38: i64 = TargetGlobalAddress<ptr @_QFEr3> 0 [TF=1]
t39: i64 = TargetGlobalAddress<ptr @_QFEr3> 0 [TF=34]
t3: i64 = undef
t6: f128,ch = load<(dereferenceable load (s128) from %ir.1)> t0, FrameIndex:i64<1>, undef:i64
t5: i64 = FrameIndex<1>
t3: i64 = undef
In function: _QQmain..omp_par
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: /lustre/home/ohno/LLVM_20240321/release/bin/flang-new -fc1 -triple aarch64-unknown-linux-gnu -emit-obj -fopenmp -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 -mframe-pointer=non-leaf -o /tmp/snfmm235_3-4e13f7.o -x f95-cpp-input snfmm235_3.f90
1. Running pass 'Function Pass Manager' on module 'FIRModule'.
2. Running pass 'AArch64 Instruction Selection' on function '@_QQmain..omp_par'
#0 0x00000000041f9f00 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/lustre/home/ohno/LLVM_20240321/release/bin/flang-new+0x41f9f00)
#1 0x00000000041f7e08 llvm::sys::RunSignalHandlers() (/lustre/home/ohno/LLVM_20240321/release/bin/flang-new+0x41f7e08)
#2 0x00000000041f7f8c SignalHandler(int) Signals.cpp:0:0
#3 0x000040001c8a07a0 (linux-vdso.so.1+0x7a0)
#4 0x000040001cd46274 raise (/lib64/libc.so.6+0x36274)
#5 0x000040001cd30a2c abort (/lib64/libc.so.6+0x20a2c)
#6 0x0000000004182d58 llvm::report_fatal_error(llvm::StringRef, bool) (/lustre/home/ohno/LLVM_20240321/release/bin/flang-new+0x4182d58)
#7 0x0000000004676b10 llvm::SelectionDAGISel::CannotYetSelect(llvm::SDNode*) (/lustre/home/ohno/LLVM_20240321/release/bin/flang-new+0x4676b10)
#8 0x000000000467a91c llvm::SelectionDAGISel::SelectCodeCommon(llvm::SDNode*, unsigned char const*, unsigned int) (/lustre/home/ohno/LLVM_20240321/release/bin/flang-new+0x467a91c)
#9 0x0000000003f9be2c (anonymous namespace)::AArch64DAGToDAGISel::Select(llvm::SDNode*) AArch64ISelDAGToDAG.cpp:0:0
#10 0x0000000004674eac llvm::SelectionDAGISel::DoInstructionSelection() (/lustre/home/ohno/LLVM_20240321/release/bin/flang-new+0x4674eac)
#11 0x0000000004681830 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/lustre/home/ohno/LLVM_20240321/release/bin/flang-new+0x4681830)
#12 0x000000000468452c llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/lustre/home/ohno/LLVM_20240321/release/bin/flang-new+0x468452c)
#13 0x00000000046859b0 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (.part.1268) SelectionDAGISel.cpp:0:0
#14 0x00000000068cbda0 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.78) MachineFunctionPass.cpp:0:0
#15 0x0000000007f91e90 llvm::FPPassManager::runOnFunction(llvm::Function&) (/lustre/home/ohno/LLVM_20240321/release/bin/flang-new+0x7f91e90)
#16 0x0000000007f920c8 llvm::FPPassManager::runOnModule(llvm::Module&) (/lustre/home/ohno/LLVM_20240321/release/bin/flang-new+0x7f920c8)
#17 0x0000000007f92bb4 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/lustre/home/ohno/LLVM_20240321/release/bin/flang-new+0x7f92bb4)
#18 0x000000000485663c Fortran::frontend::CodeGenAction::executeAction() (/lustre/home/ohno/LLVM_20240321/release/bin/flang-new+0x485663c)
#19 0x000000000422f164 Fortran::frontend::FrontendAction::execute() (/lustre/home/ohno/LLVM_20240321/release/bin/flang-new+0x422f164)
#20 0x00000000042238dc Fortran::frontend::CompilerInstance::executeAction(Fortran::frontend::FrontendAction&) (/lustre/home/ohno/LLVM_20240321/release/bin/flang-new+0x42238dc)
#21 0x0000000004233de0 Fortran::frontend::executeCompilerInvocation(Fortran::frontend::CompilerInstance*) (/lustre/home/ohno/LLVM_20240321/release/bin/flang-new+0x4233de0)
#22 0x0000000003e45678 fc1_main(llvm::ArrayRef<char const*>, char const*) (/lustre/home/ohno/LLVM_20240321/release/bin/flang-new+0x3e45678)
#23 0x0000000003dccd10 main (/lustre/home/ohno/LLVM_20240321/release/bin/flang-new+0x3dccd10)
#24 0x000040001cd34384 __libc_start_main (/lib64/libc.so.6+0x24384)
#25 0x0000000003e444fc _start (/lustre/home/ohno/LLVM_20240321/release/bin/flang-new+0x3e444fc)
flang-new: error: unable to execute command: Aborted (core dumped)
flang-new: error: flang frontend command failed due to signal (use -v to see invocation)
flang-new version 19.0.0git (https://github.com/llvm/llvm-project.git cbcdf126ccc774c063b5d5140c1393ff5305dded)
Target: aarch64-unknown-linux-gnu
Thread model: posix
InstalledDir: /lustre/home/ohno/LLVM_20240321/release/bin
flang-new: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
flang-new: note: diagnostic msg: /tmp/snfmm235_3-027b31
flang-new: note: diagnostic msg: /tmp/snfmm235_3-027b31.sh
flang-new: note: diagnostic msg:
********************
$
```
```
$ cat /tmp/snfmm235_3-027b31
#line "./snfmm235_3.f90" 1
program main
real(kind=16) r3/1/
!$omp parallel reduction(min:r3)
r3=min(r3,1.0_16)
write(6,*) "r3 = ", r3
if(r3 < 1.0_16) then
r3 = 1.0_16
end if
!$omp end parallel
write(6,*) "pass"
end program main
$
```
```
$ cat /tmp/snfmm235_3-027b31.sh
# Crash reproducer for clang version 19.0.0git (https://github.com/llvm/llvm-project.git cbcdf126ccc774c063b5d5140c1393ff5305dded)
# Driver args: "-fopenmp" "snfmm235_3.f90"
# Original command: "/lustre/home/ohno/LLVM_20240321/release/bin/flang-new" "-fc1" "-triple" "aarch64-unknown-linux-gnu" "-emit-obj" "-fopenmp" "-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" "-mframe-pointer=non-leaf" "-o" "/tmp/snfmm235_3-4e13f7.o" "-x" "f95-cpp-input" "snfmm235_3.f90"
"/lustre/home/ohno/LLVM_20240321/release/bin/flang-new" "-fc1" "-triple" "aarch64-unknown-linux-gnu" "-emit-obj" "-fopenmp" "-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" "-mframe-pointer=non-leaf" "-x" "f95-cpp-input" "snfmm235_3-027b31"
$
```
```
$ export OMP_NUM_THREADS=2; gfortran -fopenmp snfmm235_3.f90; ./a.out
r3 = 1.00000000000000000000000000000000000
r3 = 1.00000000000000000000000000000000000
pass
$
```
```
$ export OMP_NUM_THREADS=2; ifort -qopenmp -diag-disable=10448 snfmm235_3.f90; ./a.out
r3 = 1.00000000000000000000000000000000000
r3 = 1.00000000000000000000000000000000000
pass
$
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs