#2403: compile failure with gfortran 10 when using CCTK_PointerTo
Reporter:Roland Haas
Status:open
Milestone:
Version:
Type:bug
Priority:blocker
Component:

Comment (by Roland Haas):

Still not good enough. Using TYPE(*) makes the function independent of the type, but not the rank of the argument. Unfortuhantely using using TYPE(*), DIMENSION(..) for assumed rank changes how arguments are passed and CCTK_PointerTo(a) is no longer passed the address of a as its first argument. So far the best I could come up with is to overload (assuming that all compilers that check for the types are at least F90 compilers) CCTK_PointerTo on the Fortran side for up to 7 dimensions (that being the max allowed until Fortran 2008):

  interface CCTK_PointerTo
    CCTK_POINTER function CCTK_PointerTo0(a)
      type(*) :: a
    end function
    CCTK_POINTER function CCTK_PointerTo1(a)
      type(*),dimension(:) :: a
    end function
    CCTK_POINTER function CCTK_PointerTo2(a)
      type(*),dimension(:,:) :: a
    end function
    CCTK_POINTER function CCTK_PointerTo3(a)
      type(*),dimension(:,:,:) :: a
    end function
    CCTK_POINTER function CCTK_PointerTo4(a)
      type(*),dimension(:,:,:,:) :: a
    end function
    CCTK_POINTER function CCTK_PointerTo5(a)
      type(*),dimension(:,:,:,:,:) :: a
    end function
    CCTK_POINTER function CCTK_PointerTo6(a)
      type(*),dimension(:,:,:,:,:,:) :: a
    end function
    CCTK_POINTER function CCTK_PointerTo7(a)
      type(*),dimension(:,:,:,:,:,:,:) :: a
    end function
  end interface

then on the C side of things provide 8 identical CCTK_PointerTo functions.

--
Ticket URL: https://bitbucket.org/einsteintoolkit/tickets/issues/2403/compile-failure-with-gfortran-10-when