This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/82250] Fortran OpenACC acc_on_device early folding


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82250

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vries at gcc dot gnu.org

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
In libgomp/openacc.f90, we find:
....
module openacc_internal
  use openacc_kinds
  implicit none

  interface
    function acc_on_device_h (d)
      import
      integer (acc_device_kind) d
      logical acc_on_device_h
    end function
  end interface

  interface
    function acc_on_device_l (d) &
        bind (C, name = "acc_on_device")
      use iso_c_binding, only: c_int
      integer (c_int) :: acc_on_device_l
      integer (c_int), value :: d
    end function
  end interface

end module

module openacc
  use openacc_kinds
  use openacc_internal
  implicit none

  public :: acc_on_device

  interface acc_on_device
    procedure :: acc_on_device_h
  end interface

end module

function acc_on_device_h (d)
  use openacc_internal, only: acc_on_device_l
  use openacc_kinds
  integer (acc_device_kind) d
  logical acc_on_device_h
  if (acc_on_device_l (d) .eq. 1) then
    acc_on_device_h = .TRUE.
  else
    acc_on_device_h = .FALSE.
  end if
end function
...

AFAICT, a fortran test-case with an acc_on_device function call is translated
to an acc_on_device_h function call at gimple level. This is treated by the
rest of the compiler as a normal function call, there's no connection to a
builtin.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]