summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/c_loc_tests_4.f03
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gfortran.dg/c_loc_tests_4.f03')
-rw-r--r--gcc/testsuite/gfortran.dg/c_loc_tests_4.f0315
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/c_loc_tests_4.f03 b/gcc/testsuite/gfortran.dg/c_loc_tests_4.f03
new file mode 100644
index 000000000..8453ec772
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c_loc_tests_4.f03
@@ -0,0 +1,15 @@
+! { dg-do compile }
+module c_loc_tests_4
+ use, intrinsic :: iso_c_binding
+ implicit none
+
+contains
+ subroutine sub0() bind(c)
+ integer(c_int), target, dimension(10) :: my_array
+ integer(c_int), pointer, dimension(:) :: my_array_ptr
+ type(c_ptr) :: my_c_ptr
+
+ my_array_ptr => my_array
+ my_c_ptr = c_loc(my_array_ptr) ! { dg-error "must be an associated scalar POINTER" }
+ end subroutine sub0
+end module c_loc_tests_4