aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/symbol.c
diff options
context:
space:
mode:
authorAndrew Benson <abenson@carnegiescience.edu>2020-02-10 17:59:34 +0000
committerAndrew Benson <abenson@carnegiescience.edu>2020-02-10 17:59:34 +0000
commit7848054c68bad6e2aa40cb59f77cc99bd8448d52 (patch)
treec445cff040dd021e8ab81d9fd5d5e2e0139c03f5 /gcc/fortran/symbol.c
parent0cc575e4d8b68b743e07da02a74733f9b5cb585a (diff)
downloadgcc-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/symbol.c')
-rw-r--r--gcc/fortran/symbol.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c
index 96c0fc1..59f602d 100644
--- a/gcc/fortran/symbol.c
+++ b/gcc/fortran/symbol.c
@@ -1014,7 +1014,7 @@ gfc_add_allocatable (symbol_attribute *attr, locus *where)
if (check_used (attr, NULL, where))
return false;
- if (attr->allocatable)
+ if (attr->allocatable && ! gfc_submodule_procedure(attr))
{
duplicate_attr ("ALLOCATABLE", where);
return false;
@@ -1081,7 +1081,7 @@ gfc_add_dimension (symbol_attribute *attr, const char *name, locus *where)
if (check_used (attr, name, where))
return false;
- if (attr->dimension)
+ if (attr->dimension && ! gfc_submodule_procedure(attr))
{
duplicate_attr ("DIMENSION", where);
return false;
@@ -1208,7 +1208,8 @@ gfc_add_pointer (symbol_attribute *attr, locus *where)
return false;
if (attr->pointer && !(attr->if_source == IFSRC_IFBODY
- && !gfc_find_state (COMP_INTERFACE)))
+ && !gfc_find_state (COMP_INTERFACE))
+ && ! gfc_submodule_procedure(attr))
{
duplicate_attr ("POINTER", where);
return false;