Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Flang][OpenMP] Compilation error of using a reduction clause (min) with a variable (kind=16) #87955

Closed
ohno-fj opened this issue Apr 8, 2024 · 2 comments · Fixed by #89258
Closed

Comments

@ohno-fj
Copy link

ohno-fj commented Apr 8, 2024

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:

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
$
@ohno-fj ohno-fj added openmp flang Flang issues not falling into any other category labels Apr 8, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented Apr 8, 2024

@llvm/issue-subscribers-openmp

Author: None (ohno-fj)

``` Version of flang-new : 19.0.0(cbcdf12)/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:

program main
  real(kind=16) r3/1/
!$omp parallel reduction(min:r3)
  r3=min(r3,1.0_16)
  write(6,*) "r3 = ", r3
  if (r3 &lt; 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&lt;(dereferenceable load (s128) from @<!-- -->_QFEr3)&gt; t0, t41, undef:i64
    t41: i64 = AArch64ISD::ADDlow t40, TargetGlobalAddress:i64&lt;ptr @<!-- -->_QFEr3&gt; 0 [TF=34]
      t40: i64 = AArch64ISD::ADRP TargetGlobalAddress:i64&lt;ptr @<!-- -->_QFEr3&gt; 0 [TF=1]
        t38: i64 = TargetGlobalAddress&lt;ptr @<!-- -->_QFEr3&gt; 0 [TF=1]
      t39: i64 = TargetGlobalAddress&lt;ptr @<!-- -->_QFEr3&gt; 0 [TF=34]
    t3: i64 = undef
  t6: f128,ch = load&lt;(dereferenceable load (s128) from %ir.1)&gt; t0, FrameIndex:i64&lt;1&gt;, undef:i64
    t5: i64 = FrameIndex&lt;1&gt;
    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&amp;, 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&amp;) (/lustre/home/ohno/LLVM_20240321/release/bin/flang-new+0x468452c)
#<!-- -->13 0x00000000046859b0 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&amp;) (.part.1268) SelectionDAGISel.cpp:0:0
#<!-- -->14 0x00000000068cbda0 llvm::MachineFunctionPass::runOnFunction(llvm::Function&amp;) (.part.78) MachineFunctionPass.cpp:0:0
#<!-- -->15 0x0000000007f91e90 llvm::FPPassManager::runOnFunction(llvm::Function&amp;) (/lustre/home/ohno/LLVM_20240321/release/bin/flang-new+0x7f91e90)
#<!-- -->16 0x0000000007f920c8 llvm::FPPassManager::runOnModule(llvm::Module&amp;) (/lustre/home/ohno/LLVM_20240321/release/bin/flang-new+0x7f920c8)
#<!-- -->17 0x0000000007f92bb4 llvm::legacy::PassManagerImpl::run(llvm::Module&amp;) (/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&amp;) (/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&lt;char const*&gt;, 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 &lt; 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
$

@EugeneZelenko EugeneZelenko added flang:ir flang:openmp and removed openmp flang Flang issues not falling into any other category labels Apr 8, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented Apr 8, 2024

@llvm/issue-subscribers-flang-ir

Author: None (ohno-fj)

``` Version of flang-new : 19.0.0(cbcdf12)/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:

program main
  real(kind=16) r3/1/
!$omp parallel reduction(min:r3)
  r3=min(r3,1.0_16)
  write(6,*) "r3 = ", r3
  if (r3 &lt; 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&lt;(dereferenceable load (s128) from @<!-- -->_QFEr3)&gt; t0, t41, undef:i64
    t41: i64 = AArch64ISD::ADDlow t40, TargetGlobalAddress:i64&lt;ptr @<!-- -->_QFEr3&gt; 0 [TF=34]
      t40: i64 = AArch64ISD::ADRP TargetGlobalAddress:i64&lt;ptr @<!-- -->_QFEr3&gt; 0 [TF=1]
        t38: i64 = TargetGlobalAddress&lt;ptr @<!-- -->_QFEr3&gt; 0 [TF=1]
      t39: i64 = TargetGlobalAddress&lt;ptr @<!-- -->_QFEr3&gt; 0 [TF=34]
    t3: i64 = undef
  t6: f128,ch = load&lt;(dereferenceable load (s128) from %ir.1)&gt; t0, FrameIndex:i64&lt;1&gt;, undef:i64
    t5: i64 = FrameIndex&lt;1&gt;
    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&amp;, 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&amp;) (/lustre/home/ohno/LLVM_20240321/release/bin/flang-new+0x468452c)
#<!-- -->13 0x00000000046859b0 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&amp;) (.part.1268) SelectionDAGISel.cpp:0:0
#<!-- -->14 0x00000000068cbda0 llvm::MachineFunctionPass::runOnFunction(llvm::Function&amp;) (.part.78) MachineFunctionPass.cpp:0:0
#<!-- -->15 0x0000000007f91e90 llvm::FPPassManager::runOnFunction(llvm::Function&amp;) (/lustre/home/ohno/LLVM_20240321/release/bin/flang-new+0x7f91e90)
#<!-- -->16 0x0000000007f920c8 llvm::FPPassManager::runOnModule(llvm::Module&amp;) (/lustre/home/ohno/LLVM_20240321/release/bin/flang-new+0x7f920c8)
#<!-- -->17 0x0000000007f92bb4 llvm::legacy::PassManagerImpl::run(llvm::Module&amp;) (/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&amp;) (/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&lt;char const*&gt;, 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 &lt; 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
$

jsjodin added a commit that referenced this issue Apr 19, 2024
…perators (#89258)

This patch changes the lowering of max and min to be lowered to
arith::MaxNumFop and arith::MinNumFOp instead of using arith::MaximumFOp
and arith::MinimumFOp. The arith::MaximumFOp and arith::MinimumFOp map
to the corresponding intrinsics llvm.maximum.* and llvm.minimum.*
intrinsics which conform to the semantics specified in the draft of IEEE
754-2019, which is not supported by all hardware. Instead using
arith::MaximumFOp and arith::MinimumFOp will allow code generation for
more targets and match the code generated by clang OpenMP.

fixes #87955
aniplcc pushed a commit to aniplcc/llvm-project that referenced this issue Apr 21, 2024
…perators (llvm#89258)

This patch changes the lowering of max and min to be lowered to
arith::MaxNumFop and arith::MinNumFOp instead of using arith::MaximumFOp
and arith::MinimumFOp. The arith::MaximumFOp and arith::MinimumFOp map
to the corresponding intrinsics llvm.maximum.* and llvm.minimum.*
intrinsics which conform to the semantics specified in the draft of IEEE
754-2019, which is not supported by all hardware. Instead using
arith::MaximumFOp and arith::MinimumFOp will allow code generation for
more targets and match the code generated by clang OpenMP.

fixes llvm#87955
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

3 participants