summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/bind_c_usage_18.f90
diff options
context:
space:
mode:
authorburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>2008-11-22 18:18:05 +0000
committerburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>2008-11-22 18:18:05 +0000
commit209d3778a7ecf0614943c5be9263d89dfb76e80c (patch)
tree9b55d331fc080cfba7104b909bfed362f85a302e /gcc/testsuite/gfortran.dg/bind_c_usage_18.f90
parent1ab28bed908aa0f96ff5b474fc3a4bb90ba6f6d2 (diff)
downloadgcc-209d3778a7ecf0614943c5be9263d89dfb76e80c.tar.gz
2008-11-22 Tobias Burnus <burnus@net-b.de>
PR fortran/38160 * trans-types.c (gfc_validate_c_kind): Remove function. * decl.c (gfc_match_kind_spec): Add C kind parameter check. (verify_bind_c_derived_type): Remove gfc_validate_c_kind call. (verify_c_interop_param): Update call. * gfortran.h (verify_bind_c_derived_type): Update prototype. (gfc_validate_c_kind): Remove. * symbol.c (verify_bind_c_derived_type): Update verify_c_interop * call. * resolve.c (gfc_iso_c_func_interface): Ditto. 2008-11-22 Tobias Burnus <burnus@net-b.de> PR fortran/38160 * gfortran.dg/bind_c_usage_18.f90: New test. * gfortran.dg/c_kind_tests_2.f03: Update dg-messages. * gfortran.dg/interop_params.f03: Ditto. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@142124 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gfortran.dg/bind_c_usage_18.f90')
-rw-r--r--gcc/testsuite/gfortran.dg/bind_c_usage_18.f9029
1 files changed, 29 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/bind_c_usage_18.f90 b/gcc/testsuite/gfortran.dg/bind_c_usage_18.f90
new file mode 100644
index 00000000000..30534cca9a9
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/bind_c_usage_18.f90
@@ -0,0 +1,29 @@
+! { dg-do compile }
+!
+! PR fortran/38160
+!
+
+subroutine foo(x,y,z,a) bind(c) ! { dg-warning "but may not be C interoperable" }
+ use iso_c_binding
+ implicit none
+ integer(4) :: x
+ integer(c_float) :: y ! { dg-error "C kind type parameter is for type REAL" }
+ complex(c_float) :: z ! OK, c_float == c_float_complex
+ real(c_float_complex) :: a ! OK, c_float == c_float_complex
+end subroutine foo
+
+use iso_c_binding
+implicit none
+integer, parameter :: it = c_int
+integer, parameter :: dt = c_double
+complex(c_int), target :: z1 ! { dg-error "C kind type parameter is for type INTEGER" }
+complex(it), target :: z2 ! { dg-error "C kind type parameter is for type INTEGER" }
+complex(c_double), target :: z3 ! OK
+complex(dt), target :: z4 ! OK
+type(c_ptr) :: ptr
+
+ptr = c_loc(z1)
+ptr = c_loc(z2)
+ptr = c_loc(z3)
+ptr = c_loc(z4)
+end