diff options
author | Harald Anlauf <anlauf@gmx.de> | 2023-03-17 22:24:49 +0100 |
---|---|---|
committer | Harald Anlauf <anlauf@gmx.de> | 2023-03-24 19:40:42 +0100 |
commit | dca8e28c990547648543175de9b6e05356f77e8a (patch) | |
tree | 24f24fc90f289058cb63e793c93fbf01e11a10bd /gcc/fortran | |
parent | 840268549508fe161721b1ada0542dd42137916f (diff) | |
download | gcc-dca8e28c990547648543175de9b6e05356f77e8a.zip gcc-dca8e28c990547648543175de9b6e05356f77e8a.tar.gz gcc-dca8e28c990547648543175de9b6e05356f77e8a.tar.bz2 |
Fortran: procedures with BIND(C) attribute require explicit interface [PR85877]
gcc/fortran/ChangeLog:
PR fortran/85877
* resolve.c (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.
(cherry picked from commit 5426ab34643d9e6502f3ee572891a03471fa33ed)
Diffstat (limited to 'gcc/fortran')
-rw-r--r-- | gcc/fortran/resolve.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 98e9404..dc127ab 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -13413,6 +13413,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; } |