[flang-commits] [flang] [flang] Retain internal and BIND(C) host procedure link in FIR (PR #87796)

Dominik Adamski via flang-commits flang-commits at lists.llvm.org
Tue Apr 23 05:28:13 PDT 2024


DominikAdamski wrote:

Hi,
Your PR breaks compilation of OpenMP Fortran code:
``` 
program test
use, intrinsic :: iso_fortran_env
implicit none
    integer, parameter :: n = 1024
    integer(int32) :: x(n),  y(n)
    integer :: i
    x = 1
    y = 0
    y = test_offload(x)
    do i = 1,n
      if ( x(i) .ne. y(i)) then
        stop 1
      endif
    enddo
    print *, "Test passed"

    contains
        function test_offload(xin) result(xout)
            integer(int32), intent(in) :: xin(1024)
            integer(int32) :: xout(1024)
            integer :: ii
            xout = 0.0
!$omp target parallel do map(to:xin) map(from: xout)
            do ii=1,1024
                xout(ii) = xin(ii)
            end do
!$omp end target parallel do
        end function test_offload
end program test
```
Compilation command:
`flang-new   -O2  -fopenmp --offload-arch=sm_70  test.f95 -o main`

I observe ICE when flang-new tries to lower MLIR code to LLVM IR.

https://github.com/llvm/llvm-project/pull/87796


More information about the flang-commits mailing list