aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/resolve.cc
diff options
context:
space:
mode:
authorHarald Anlauf <anlauf@gmx.de>2023-03-17 22:24:49 +0100
committerHarald Anlauf <anlauf@gmx.de>2023-03-19 20:32:10 +0100
commit5426ab34643d9e6502f3ee572891a03471fa33ed (patch)
treecbd06e90f1d829408b9561842e488fc8fde88fc7 /gcc/fortran/resolve.cc
parent655689f6be8606991f8a3359eadf017af7238a88 (diff)
downloadgcc-5426ab34643d9e6502f3ee572891a03471fa33ed.zip
gcc-5426ab34643d9e6502f3ee572891a03471fa33ed.tar.gz
gcc-5426ab34643d9e6502f3ee572891a03471fa33ed.tar.bz2
Fortran: procedures with BIND(C) attribute require explicit interface [PR85877]
gcc/fortran/ChangeLog: PR fortran/85877 * resolve.cc (resolve_fl_procedure): Check for an explicit interface of procedures with the BIND(C) attribute (F2018:15.4.2.2). gcc/testsuite/ChangeLog: PR fortran/85877 * gfortran.dg/pr85877.f90: New test.
Diffstat (limited to 'gcc/fortran/resolve.cc')
-rw-r--r--gcc/fortran/resolve.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc
index ba603b4..f3f3051 100644
--- a/gcc/fortran/resolve.cc
+++ b/gcc/fortran/resolve.cc
@@ -13871,6 +13871,16 @@ check_formal:
}
}
}
+
+ /* F2018:15.4.2.2 requires an explicit interface for procedures with the
+ BIND(C) attribute. */
+ if (sym->attr.is_bind_c && sym->attr.if_source == IFSRC_UNKNOWN)
+ {
+ gfc_error ("Interface of %qs at %L must be explicit",
+ sym->name, &sym->declared_at);
+ return false;
+ }
+
return true;
}