+2013-01-09 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/55758
+ * resolve.c (resolve_symbol): Reject non-C_Bool logicals
+ in BIND(C) procedures with -std=f*.
+
2013-01-08 Paul Thomas <pault@gcc.gnu.org>
PR fortran/55618
return;
}
+ if (sym->ts.type == BT_LOGICAL
+ && ((sym->attr.function && sym->attr.is_bind_c && sym->result == sym)
+ || ((sym->attr.dummy || sym->attr.result) && sym->ns->proc_name
+ && sym->ns->proc_name->attr.is_bind_c)))
+ {
+ int i;
+ for (i = 0; gfc_logical_kinds[i].kind; i++)
+ if (gfc_logical_kinds[i].kind == sym->ts.kind)
+ break;
+ if (!gfc_logical_kinds[i].c_bool && sym->attr.dummy
+ && gfc_notify_std (GFC_STD_GNU, "LOGICAL dummy argument '%s' at %L "
+ "with non-C_Bool kind in BIND(C) procedure '%s'",
+ sym->name, &sym->declared_at,
+ sym->ns->proc_name->name) == FAILURE)
+ return;
+ else if (!gfc_logical_kinds[i].c_bool
+ && gfc_notify_std (GFC_STD_GNU, "LOGICAL result variable '%s' at"
+ " %L with non-C_Bool kind in BIND(C) "
+ "procedure '%s'", sym->name,
+ &sym->declared_at,
+ sym->attr.function ? sym->name
+ : sym->ns->proc_name->name)
+ == FAILURE)
+ return;
+ }
+
switch (sym->attr.flavor)
{
case FL_VARIABLE:
+2013-01-09 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/55758
+ * gfortran.dg/bind_c_bool_1.f90: New.
+ * gfortran.dg/do_5.f90: Add dg-warning.
+
2013-01-09 Jan Hubicka <jh@suse.cz>
PR tree-optimiation/55875
--- /dev/null
+! { dg-do compile }
+! { dg-options "-std=f2003" }
+!
+! PR fortran/55758
+!
+
+function sub2() bind(C) ! { dg-error "GNU Extension: LOGICAL result variable 'sub2' at .1. with non-C_Bool kind in BIND.C. procedure 'sub2'" }
+ logical(kind=8) :: sub2
+ logical(kind=4) :: local ! OK
+end function sub2
+
+function sub4() bind(C) result(res) ! { dg-error "GNU Extension: LOGICAL result variable 'res' at .1. with non-C_Bool kind in BIND.C. procedure 'sub4'" }
+ logical(kind=2) :: res
+ logical(kind=4) :: local ! OK
+end function sub4
+
+
+subroutine sub(x) bind(C) ! { dg-error "GNU Extension: LOGICAL dummy argument 'x' at .1. with non-C_Bool kind in BIND.C. procedure 'sub'" }
+ logical(kind=4) :: x
+end subroutine sub
+
+subroutine sub3(y) bind(C)
+ use iso_c_binding, only : c_bool
+ logical(kind=c_bool) :: y ! OK
+end subroutine sub3