diff options
author | Andrew Benson <abenson@carnegiescience.edu> | 2020-02-10 17:59:34 +0000 |
---|---|---|
committer | Andrew Benson <abenson@carnegiescience.edu> | 2020-02-10 17:59:34 +0000 |
commit | 7848054c68bad6e2aa40cb59f77cc99bd8448d52 (patch) | |
tree | c445cff040dd021e8ab81d9fd5d5e2e0139c03f5 /gcc/fortran/array.c | |
parent | 0cc575e4d8b68b743e07da02a74733f9b5cb585a (diff) | |
download | gcc-7848054c68bad6e2aa40cb59f77cc99bd8448d52.zip gcc-7848054c68bad6e2aa40cb59f77cc99bd8448d52.tar.gz gcc-7848054c68bad6e2aa40cb59f77cc99bd8448d52.tar.bz2 |
Fix bogus duplicate attribute errors for submodule functions.
PR fortran/83113
* array.c: Do not attempt to set the array spec for a submodule
function symbol (as it has already been set in the corresponding
module procedure interface).
* symbol.c: Do not reject duplicate POINTER, ALLOCATABLE, or
DIMENSION attributes in declarations of a submodule function.
* gfortran.h: Add a macro that tests for a module procedure in a
submodule.
* gfortran.dg/pr83113.f90: New test.
Diffstat (limited to 'gcc/fortran/array.c')
-rw-r--r-- | gcc/fortran/array.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/gcc/fortran/array.c b/gcc/fortran/array.c index c873cf2..82b0eb3 100644 --- a/gcc/fortran/array.c +++ b/gcc/fortran/array.c @@ -23,6 +23,7 @@ along with GCC; see the file COPYING3. If not see #include "coretypes.h" #include "options.h" #include "gfortran.h" +#include "parse.h" #include "match.h" #include "constructor.h" @@ -822,7 +823,6 @@ cleanup: return MATCH_ERROR; } - /* Given a symbol and an array specification, modify the symbol to have that array specification. The error locus is needed in case something goes wrong. On failure, the caller must free the spec. */ @@ -831,10 +831,17 @@ bool gfc_set_array_spec (gfc_symbol *sym, gfc_array_spec *as, locus *error_loc) { int i; - + symbol_attribute *attr; + if (as == NULL) return true; + /* If the symbol corresponds to a submodule module procedure the array spec is + already set, so do not attempt to set it again here. */ + attr = &sym->attr; + if (gfc_submodule_procedure(attr)) + return true; + if (as->rank && !gfc_add_dimension (&sym->attr, sym->name, error_loc)) return false; |