diff options
author | Steven G. Kargl <kargl@gcc.gnu.org> | 2018-03-22 21:42:07 +0000 |
---|---|---|
committer | Steven G. Kargl <kargl@gcc.gnu.org> | 2018-03-22 21:42:07 +0000 |
commit | b74fa12697a7b369368b8792ea8217ba5fcfaf85 (patch) | |
tree | f47abe155e17a6b3a3886a786d592ec08935e987 /gcc/fortran | |
parent | 0bf86d4683e42967bc55de1d3b5bc31a713396f1 (diff) | |
download | gcc-b74fa12697a7b369368b8792ea8217ba5fcfaf85.zip gcc-b74fa12697a7b369368b8792ea8217ba5fcfaf85.tar.gz gcc-b74fa12697a7b369368b8792ea8217ba5fcfaf85.tar.bz2 |
re PR fortran/84922 (fortran reports inconsistency in rank of arguments in interface and contained procedures)
2018-03-22 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/84922
* decl.c (get_proc_name): If the MODULE prefix appears in interface
body, then it must appear on the contained subroutine or function.
While here, fix nearby mis-indented code.
2018-03-22 Steven G. Kargl <kargl@gcc.gnu.org
PR fortran/84922
* gfortran.dg/interface_42.f90: New test.
* gfortran.dg/interface_43.f90: New test.
From-SVN: r258784
Diffstat (limited to 'gcc/fortran')
-rw-r--r-- | gcc/fortran/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/fortran/decl.c | 29 |
2 files changed, 27 insertions, 9 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 87c78eb..64142c5 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,10 @@ +2018-03-22 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/84922 + * decl.c (get_proc_name): If the MODULE prefix appears in interface + body, then it must appear on the contained subroutine or function. + While here, fix nearby mis-indented code. + 2018-03-21 Thomas Koenig <tkoenig@gcc.gnu.org> Harald Anlauf <anlauf@gmx.de> diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index f6649cf..a826890 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -1245,15 +1245,26 @@ get_proc_name (const char *name, gfc_symbol **result, bool module_fcn_entry) "from a previous declaration", name); } - if (sym && !sym->gfc_new - && sym->attr.flavor != FL_UNKNOWN - && sym->attr.referenced == 0 && sym->attr.subroutine == 1 - && gfc_state_stack->state == COMP_CONTAINS - && gfc_state_stack->previous->state == COMP_SUBROUTINE) - { - gfc_error_now ("Procedure %qs at %C is already defined at %L", - name, &sym->declared_at); - } + /* C1246 (R1225) MODULE shall appear only in the function-stmt or + subroutine-stmt of a module subprogram or of a nonabstract interface + body that is declared in the scoping unit of a module or submodule. */ + if (sym->attr.external + && (sym->attr.subroutine || sym->attr.function) + && sym->attr.if_source == IFSRC_IFBODY + && !current_attr.module_procedure + && sym->attr.proc == PROC_MODULE + && gfc_state_stack->state == COMP_CONTAINS) + gfc_error_now ("Procedure %qs defined in interface body at %L " + "clashes with internal procedure defined at %C", + name, &sym->declared_at); + + if (sym && !sym->gfc_new + && sym->attr.flavor != FL_UNKNOWN + && sym->attr.referenced == 0 && sym->attr.subroutine == 1 + && gfc_state_stack->state == COMP_CONTAINS + && gfc_state_stack->previous->state == COMP_SUBROUTINE) + gfc_error_now ("Procedure %qs at %C is already defined at %L", + name, &sym->declared_at); if (gfc_current_ns->parent == NULL || *result == NULL) return rc; |