summaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
authorburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>2013-01-09 16:20:33 +0000
committerburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>2013-01-09 16:20:33 +0000
commit3bbb71baceae7654a0d58fe9475d95f60022303b (patch)
tree8c9ed8d07dd16e0ee559cf714c7b5fc41bb2bb4d /gcc/fortran
parent64552007d8a577b79d9655c273e1c8f820dba9a4 (diff)
downloadgcc-3bbb71baceae7654a0d58fe9475d95f60022303b.tar.gz
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-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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@195055 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran')
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/resolve.c26
2 files changed, 32 insertions, 0 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 6d1b2c68b10..d8c54488371 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,9 @@
+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
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 99c1996d9a2..e05dfd30fbf 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -13671,6 +13671,32 @@ resolve_symbol (gfc_symbol *sym)
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: