diff options
author | Tobias Burnus <burnus@net-b.de> | 2011-11-03 23:36:11 +0100 |
---|---|---|
committer | Tobias Burnus <burnus@gcc.gnu.org> | 2011-11-03 23:36:11 +0100 |
commit | a9e88ec6fe9438c79b19601f9c20ef77bea4ef9e (patch) | |
tree | a8bafa1abd8a8d1dfd41bc09135208d21d80b362 /gcc | |
parent | 1e4b137661742691d56e11d8dfe9342faa4e0c3c (diff) | |
download | gcc-a9e88ec6fe9438c79b19601f9c20ef77bea4ef9e.zip gcc-a9e88ec6fe9438c79b19601f9c20ef77bea4ef9e.tar.gz gcc-a9e88ec6fe9438c79b19601f9c20ef77bea4ef9e.tar.bz2 |
re PR fortran/50933 (Wrongly regards BIND(C) types as incompatible)
2011-11-03 Tobias Burnus <burnus@net-b.de>
PR fortran/50933
* interface.c (gfc_compare_derived_types): Fix check for
* BIND(C).
2011-11-03 Tobias Burnus <burnus@net-b.de>
PR fortran/50933
* gfortran.dg/bind_c_dts_5.f90: New.
From-SVN: r180879
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/fortran/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/fortran/interface.c | 5 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/bind_c_dts_5.f90 | 54 |
4 files changed, 67 insertions, 2 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index f29eab0..ac6e29b 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,5 +1,10 @@ 2011-11-03 Tobias Burnus <burnus@net-b.de> + PR fortran/50933 + * interface.c (gfc_compare_derived_types): Fix check for BIND(C). + +2011-11-03 Tobias Burnus <burnus@net-b.de> + PR fortran/50960 * trans-decl.c (gfc_finish_var_decl): Mark PARAMETER as TREE_READONLY. diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c index 5308513..19ede06 100644 --- a/gcc/fortran/interface.c +++ b/gcc/fortran/interface.c @@ -405,7 +405,7 @@ gfc_compare_derived_types (gfc_symbol *derived1, gfc_symbol *derived2) return 1; /* Compare type via the rules of the standard. Both types must have - the SEQUENCE attribute to be equal. */ + the SEQUENCE or BIND(C) attribute to be equal. */ if (strcmp (derived1->name, derived2->name)) return 0; @@ -414,7 +414,8 @@ gfc_compare_derived_types (gfc_symbol *derived1, gfc_symbol *derived2) || derived2->component_access == ACCESS_PRIVATE) return 0; - if (derived1->attr.sequence == 0 || derived2->attr.sequence == 0) + if (!(derived1->attr.sequence && derived2->attr.sequence) + && !(derived1->attr.is_bind_c && derived2->attr.is_bind_c)) return 0; dt1 = derived1->components; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d561072..91d4174 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2011-11-03 Tobias Burnus <burnus@net-b.de> + PR fortran/50933 + * gfortran.dg/bind_c_dts_5.f90: New. + +2011-11-03 Tobias Burnus <burnus@net-b.de> + PR fortran/50960 * gfortran.dg/module_parameter_array_refs_2.f90: New. diff --git a/gcc/testsuite/gfortran.dg/bind_c_dts_5.f90 b/gcc/testsuite/gfortran.dg/bind_c_dts_5.f90 new file mode 100644 index 0000000..497c050 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/bind_c_dts_5.f90 @@ -0,0 +1,54 @@ +! { dg-do compile } +! +! PR fortran/50933 +! +! Check whether type-compatibility checks for BIND(C) work. +! +! Contributed by Richard Maine +! + +MODULE liter_cb_mod +USE ISO_C_BINDING +CONTAINS + FUNCTION liter_cb(link_info) bind(C) + USE ISO_C_BINDING + IMPLICIT NONE + + INTEGER(c_int) liter_cb + + TYPE, bind(C) :: info_t + INTEGER(c_int) :: type + END TYPE info_t + + TYPE(info_t) :: link_info + + liter_cb = 0 + + END FUNCTION liter_cb + +END MODULE liter_cb_mod + +PROGRAM main + USE ISO_C_BINDING + interface + FUNCTION liter_cb(link_info) bind(C) + USE ISO_C_BINDING + IMPLICIT NONE + INTEGER(c_int) liter_cb + TYPE, bind(C) :: info_t + INTEGER(c_int) :: type + END TYPE info_t + TYPE(info_t) :: link_info + END FUNCTION liter_cb + end interface + + TYPE, bind(C) :: info_t + INTEGER(c_int) :: type + END TYPE info_t + type(info_t) :: link_info + + write (*,*) liter_cb(link_info) + +END PROGRAM main + +! { dg-final { cleanup-modules "liter_cb_mod" } } |