summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/c_loc_tests_5.f03
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gfortran.dg/c_loc_tests_5.f03')
-rw-r--r--gcc/testsuite/gfortran.dg/c_loc_tests_5.f0319
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/c_loc_tests_5.f03 b/gcc/testsuite/gfortran.dg/c_loc_tests_5.f03
new file mode 100644
index 000000000..a389437ce
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c_loc_tests_5.f03
@@ -0,0 +1,19 @@
+! { dg-do compile }
+module c_loc_tests_5
+ use, intrinsic :: iso_c_binding, only: c_char, c_ptr, c_loc, c_int
+
+contains
+ subroutine sub0() bind(c)
+ type(c_ptr) :: f_ptr, my_c_ptr
+ character(kind=c_char, len=20), target :: format
+ integer(c_int), dimension(:), pointer :: int_ptr
+ integer(c_int), dimension(10), target :: int_array
+
+ f_ptr = c_loc(format(1:1))
+
+ int_ptr => int_array
+ my_c_ptr = c_loc(int_ptr(0))
+
+ end subroutine sub0
+end module c_loc_tests_5
+! { dg-final { cleanup-modules "c_loc_tests_5" } }