diff options
author | Mark Eggleston <markeggleston@gcc.gnu.org> | 2020-05-07 08:02:02 +0100 |
---|---|---|
committer | Mark Eggleston <markeggleston@gcc.gnu.org> | 2020-05-20 14:28:41 +0100 |
commit | eb069ae8819c3a84d7f78becc5501e21ee3a9554 (patch) | |
tree | fa0a916ef7b46b7456bf985868f2f4bda258165f /gcc/fortran/symbol.c | |
parent | 4623a6f2d026b6b6dcd4c9b6f26e96cf5e52b4ac (diff) | |
download | gcc-eb069ae8819c3a84d7f78becc5501e21ee3a9554.zip gcc-eb069ae8819c3a84d7f78becc5501e21ee3a9554.tar.gz gcc-eb069ae8819c3a84d7f78becc5501e21ee3a9554.tar.bz2 |
Fortran : ProcPtr function results: 'ppr@' in error message PR39695
The value 'ppr@' is set in the name of result symbol, the actual
name of the symbol is in the procedure name symbol pointed
to by the result symbol's namespace (ns). When reporting errors for
symbols that have the proc_pointer attribute check whether the
result attribute is set and set the name accordingly.
2020-05-20 Mark Eggleston <markeggleston@gcc.gnu.org>
gcc/fortran/
PR fortran/39695
* resolve.c (resolve_fl_procedure): Set name depending on
whether the result attribute is set. For PROCEDURE/RESULT
conflict use the name in sym->ns->proc_name->name.
* symbol.c (gfc_add_type): Add check for function and result
attributes use sym->ns->proc_name->name if both are set.
Where the symbol cannot have a type use the name in
sym->ns->proc_name->name.
2020-05-20 Mark Eggleston <markeggleston@gcc.gnu.org>
gcc/testsuite/
PR fortran/39695
* gfortran.dg/pr39695_1.f90: New test.
* gfortran.dg/pr39695_2.f90: New test.
* gfortran.dg/pr39695_3.f90: New test.
* gfortran.dg/pr39695_4.f90: New test.
Diffstat (limited to 'gcc/fortran/symbol.c')
-rw-r--r-- | gcc/fortran/symbol.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c index 59f602d..b967061 100644 --- a/gcc/fortran/symbol.c +++ b/gcc/fortran/symbol.c @@ -2004,9 +2004,12 @@ gfc_add_type (gfc_symbol *sym, gfc_typespec *ts, locus *where) gfc_error ("Symbol %qs at %L conflicts with symbol from module %qs, " "use-associated at %L", sym->name, where, sym->module, &sym->declared_at); + else if (sym->attr.function && sym->attr.result) + gfc_error ("Symbol %qs at %L already has basic type of %s", + sym->ns->proc_name->name, where, gfc_basic_typename (type)); else gfc_error ("Symbol %qs at %L already has basic type of %s", sym->name, - where, gfc_basic_typename (type)); + where, gfc_basic_typename (type)); return false; } @@ -2024,7 +2027,7 @@ gfc_add_type (gfc_symbol *sym, gfc_typespec *ts, locus *where) || (flavor == FL_PROCEDURE && sym->attr.subroutine) || flavor == FL_DERIVED || flavor == FL_NAMELIST) { - gfc_error ("Symbol %qs at %L cannot have a type", sym->name, where); + gfc_error ("Symbol %qs at %L cannot have a type", sym->ns->proc_name->name, where); return false; } |