Paul Thanks for providing me with a working example. It allowed me to create a reproducer for error 1251 at compile time using FTN95 v.9.10 x64. The reproducer compiles with ifort.
program main
use iso_c_binding,only:c_ptr,c_f_pointer
implicit none
interface
subroutine c_f_pointer_test$(q) bind(c,name='__c_f_pointer_test')
import :: c_ptr
type(c_ptr), intent(out) :: q
end subroutine
end interface
type(c_ptr) :: cptr
REAL :: X
call c_f_pointer_test$(cptr)
X=TEST(cptr)
PRINT*, X
CONTAINS
REAL FUNCTION TEST(J)
implicit none
type(c_ptr), INTENT(IN) :: J
real,pointer :: a(:)
real,pointer :: b(:,:)
real,pointer :: c
real::ss1,ss2
integer s(1)
s = [12]
call c_f_pointer(J, a, s)
ss1 = sum(a)
call c_f_pointer(J, b, [3,4])
ss2 = sum(b)
call c_f_pointer(J, c)
if(ss1 == ss2 .and. c == 1.0) print*, 'Success'
TEST=a(12)
END FUNCTION TEST
end program main