aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/symbol.c
diff options
context:
space:
mode:
authorTobias Burnus <burnus@net-b.de>2007-06-24 18:19:11 +0200
committerTobias Burnus <burnus@gcc.gnu.org>2007-06-24 18:19:11 +0200
commit2eae3dc776d21ca736df7805977f39af98513b31 (patch)
treefeea8d3621fb013795c4e24773c0d395214dd5fc /gcc/fortran/symbol.c
parentf0b3c58d8be622e7305c7d503a5d81b96b1db621 (diff)
downloadgcc-2eae3dc776d21ca736df7805977f39af98513b31.zip
gcc-2eae3dc776d21ca736df7805977f39af98513b31.tar.gz
gcc-2eae3dc776d21ca736df7805977f39af98513b31.tar.bz2
re PR fortran/32460 (structure constructor not allowed if a USEd type has private components)
2007-06-24 Tobias Burnus <burnus@net-de> PR fortran/32460 * interface.c (gfc_compare_derived_types): Add access check. * symbol.c (gfc_find_component): Ditto. (gfc_set_component_attr,gfc_get_component_attr) Copy access state. * dump-parse-tree.c (gfc_show_components): Dump access state. * gfortran.h (struct gfc_component): Add gfc_access. * module.c (mio_component): Add access state. * (gfc_match_structure_constructor): Check for private access state. 2007-06-24 Tobias Burnus <burnus@net-de> PR fortran/32460 * gfortran.dg/private_type_6.f90: New. From-SVN: r125984
Diffstat (limited to 'gcc/fortran/symbol.c')
-rw-r--r--gcc/fortran/symbol.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c
index 3c11b64..e1b27dc 100644
--- a/gcc/fortran/symbol.c
+++ b/gcc/fortran/symbol.c
@@ -1615,7 +1615,8 @@ gfc_find_component (gfc_symbol *sym, const char *name)
name, sym->name);
else
{
- if (sym->attr.use_assoc && sym->component_access == ACCESS_PRIVATE)
+ if (sym->attr.use_assoc && (sym->component_access == ACCESS_PRIVATE
+ || p->access == ACCESS_PRIVATE))
{
gfc_error ("Component '%s' at %C is a PRIVATE component of '%s'",
name, sym->name);
@@ -1656,6 +1657,7 @@ gfc_set_component_attr (gfc_component *c, symbol_attribute *attr)
c->dimension = attr->dimension;
c->pointer = attr->pointer;
c->allocatable = attr->allocatable;
+ c->access = attr->access;
}
@@ -1670,6 +1672,7 @@ gfc_get_component_attr (symbol_attribute *attr, gfc_component *c)
attr->dimension = c->dimension;
attr->pointer = c->pointer;
attr->allocatable = c->allocatable;
+ attr->access = c->access;
}