diff options
author | Harald Anlauf <anlauf@gmx.de> | 2021-08-28 20:09:44 +0200 |
---|---|---|
committer | Harald Anlauf <anlauf@gmx.de> | 2021-08-28 20:09:44 +0200 |
commit | f9809ef57005409ee658294d6e8dad9ee8897e88 (patch) | |
tree | dda4d9ba8f356fd98ef16a9878e328af79ee660d /gcc/fortran/resolve.c | |
parent | 754fca77e82a59d85c735a5aff49ee2b1ec4c6df (diff) | |
download | gcc-f9809ef57005409ee658294d6e8dad9ee8897e88.zip gcc-f9809ef57005409ee658294d6e8dad9ee8897e88.tar.gz gcc-f9809ef57005409ee658294d6e8dad9ee8897e88.tar.bz2 |
Fortran - reject function entries with mismatched characteristics
gcc/fortran/ChangeLog:
PR fortran/87737
* resolve.c (resolve_entries): For functions of type CHARACTER
tighten the checks for matching characteristics.
gcc/testsuite/ChangeLog:
PR fortran/87737
* gfortran.dg/entry_24.f90: New test.
Diffstat (limited to 'gcc/fortran/resolve.c')
-rw-r--r-- | gcc/fortran/resolve.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 5b9ba43..f641d0d 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -804,6 +804,15 @@ resolve_entries (gfc_namespace *ns) the same string length, i.e. both len=*, or both len=4. Having both len=<variable> is also possible, but difficult to check at compile time. */ + else if (ts->type == BT_CHARACTER + && (el->sym->result->attr.allocatable + != ns->entries->sym->result->attr.allocatable)) + { + gfc_error ("Function %s at %L has entry %s with mismatched " + "characteristics", ns->entries->sym->name, + &ns->entries->sym->declared_at, el->sym->name); + return; + } else if (ts->type == BT_CHARACTER && ts->u.cl && fts->u.cl && (((ts->u.cl->length && !fts->u.cl->length) ||(!ts->u.cl->length && fts->u.cl->length)) |