RISC-V: Regenerate opt urls.
[official-gcc.git] / gcc / testsuite / gfortran.dg / scalar_pointer_1.f90
blobd421f3884584d967df550f6156990913319f51ce
1 ! { dg-do compile }
2 ! { dg-options "-std=f2003" }
3 ! PR fortran/84924
4 ! Testcase contributed by Seth Johnson <johnsonsr@ornl.gov>
6 module ftest
7 use ISO_C_BINDING
8 implicit none
10 type :: Cls
11 end type
13 type :: ClsHandle
14 class(Cls), pointer :: ptr
15 end type
16 contains
17 subroutine to_ptr(c, p)
18 use ISO_C_BINDING
19 class(Cls), intent(in), target :: c
20 type(C_PTR), intent(out) :: p
21 type(ClsHandle), pointer :: handle
22 allocate(handle)
23 handle%ptr => c
24 p = c_loc(handle)
25 end subroutine
27 subroutine from_ptr(p, c)
28 use ISO_C_BINDING
29 type(C_PTR), intent(in) :: p
30 class(Cls), intent(out), pointer :: c
31 type(ClsHandle), pointer :: handle
32 call c_f_pointer(cptr=p, fptr=handle)
33 c => handle%ptr
34 deallocate(handle)
35 end subroutine
36 end module