[Bug fortran/50933] Wrongly regards BIND(C) types as incompatible

2011-11-03 Thread burnus at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50933

--- Comment #2 from Tobias Burnus burnus at gcc dot gnu.org 2011-11-03 
22:36:19 UTC ---
Author: burnus
Date: Thu Nov  3 22:36:11 2011
New Revision: 180879

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=180879
Log:
2011-11-03  Tobias Burnus  bur...@net-b.de

PR fortran/50933
* interface.c (gfc_compare_derived_types): Fix check for
* BIND(C).

2011-11-03  Tobias Burnus  bur...@net-b.de

PR fortran/50933
* gfortran.dg/bind_c_dts_5.f90: New.


Added:
trunk/gcc/testsuite/gfortran.dg/bind_c_dts_5.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/interface.c
trunk/gcc/testsuite/ChangeLog


[Bug fortran/50933] Wrongly regards BIND(C) types as incompatible

2011-11-03 Thread burnus at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50933

Tobias Burnus burnus at gcc dot gnu.org changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution||FIXED

--- Comment #3 from Tobias Burnus burnus at gcc dot gnu.org 2011-11-03 
22:43:46 UTC ---
FIXED on the 4.7 trunk.


[Bug fortran/50933] Wrongly regards BIND(C) types as incompatible

2011-11-02 Thread burnus at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50933

--- Comment #1 from Tobias Burnus burnus at gcc dot gnu.org 2011-11-02 
08:30:20 UTC ---
Untested patch:

--- 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;