OSDN Git Service

2010-08-15 Tobias Burnus <burnus@net-b.de>
authorburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 15 Aug 2010 16:20:56 +0000 (16:20 +0000)
committerburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 15 Aug 2010 16:20:56 +0000 (16:20 +0000)
        PR fortran/45211
        * decl.c (verify_c_interop_param): Remove superfluous space (" ").
        (verify_c_interop): Handle unresolved DT with bind(C).

2010-08-15  Tobias Burnus  <burnus@net-b.de>

        PR fortran/45211
        * gfortran.dg/bind_c_usage_21.f90: New.
        * gfortran.dg/bind_c_dts_3.f03: Update dg-error.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@163264 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/fortran/ChangeLog
gcc/fortran/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/bind_c_dts_3.f03
gcc/testsuite/gfortran.dg/bind_c_usage_21.f90 [new file with mode: 0644]

index 4bddcb4..b88d9c9 100644 (file)
@@ -1,5 +1,11 @@
 2010-08-15  Tobias Burnus  <burnus@net-b.de>
 
+       PR fortran/45211
+       * decl.c (verify_c_interop_param): Remove superfluous space (" ").
+       (verify_c_interop): Handle unresolved DT with bind(C).
+
+2010-08-15  Tobias Burnus  <burnus@net-b.de>
+
        * trans-expr.c (gfc_conv_expr_present): Regard nullified
        pointer arrays as absent.
        (gfc_conv_procedure_call): Handle EXPR_NULL for non-pointer
index be41af8..5baa400 100644 (file)
@@ -991,7 +991,7 @@ verify_c_interop_param (gfc_symbol *sym)
              /* Make personalized messages to give better feedback.  */
              if (sym->ts.type == BT_DERIVED)
                gfc_error ("Type '%s' at %L is a parameter to the BIND(C) "
-                          " procedure '%s' but is not C interoperable "
+                          "procedure '%s' but is not C interoperable "
                           "because derived type '%s' is not C interoperable",
                           sym->name, &(sym->declared_at),
                           sym->ns->proc_name->name, 
@@ -3612,7 +3612,8 @@ gfc_try
 verify_c_interop (gfc_typespec *ts)
 {
   if (ts->type == BT_DERIVED && ts->u.derived != NULL)
-    return (ts->u.derived->ts.is_c_interop ? SUCCESS : FAILURE);
+    return (ts->u.derived->ts.is_c_interop || ts->u.derived->attr.is_bind_c)
+          ? SUCCESS : FAILURE;
   else if (ts->is_c_interop != 1)
     return FAILURE;
   
index 1065b33..7c43d39 100644 (file)
@@ -1,5 +1,11 @@
 2010-08-15  Tobias Burnus  <burnus@net-b.de>
 
+       PR fortran/45211
+       * gfortran.dg/bind_c_usage_21.f90: New.
+       * gfortran.dg/bind_c_dts_3.f03: Update dg-error.
+
+2010-08-15  Tobias Burnus  <burnus@net-b.de>
+
        * gfortran.dg/optional_absent_1.f90: New.
        * gfortran.dg/null_actual.f90: New.
 
index 6c6da9f..fa54fb7 100644 (file)
@@ -26,7 +26,7 @@ type, bind(c):: t3 ! { dg-error "BIND.C. derived type" }
 end type t3
 
 contains
-  subroutine sub0(my_type, expected_value) bind(c) ! { dg-error "is not C interoperable" }
+  subroutine sub0(my_type, expected_value) bind(c)
     type(my_c_type_1) :: my_type
     integer(c_int), value :: expected_value
 
diff --git a/gcc/testsuite/gfortran.dg/bind_c_usage_21.f90 b/gcc/testsuite/gfortran.dg/bind_c_usage_21.f90
new file mode 100644 (file)
index 0000000..10a86db
--- /dev/null
@@ -0,0 +1,25 @@
+! { dg-do compile }
+!
+! PR fortran/45211
+!
+! Contributed by Scot Breitenfeld
+!
+module m
+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 m
+
+! { dg-final { cleanup-modules "m" } }