aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/primary.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/primary.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/primary.c')
-rw-r--r--gcc/fortran/primary.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c
index 90b1d68..14253f6 100644
--- a/gcc/fortran/primary.c
+++ b/gcc/fortran/primary.c
@@ -1888,6 +1888,7 @@ gfc_match_structure_constructor (gfc_symbol *sym, gfc_expr **result)
gfc_expr *e;
locus where;
match m;
+ bool private_comp = false;
head = tail = NULL;
@@ -1900,6 +1901,11 @@ gfc_match_structure_constructor (gfc_symbol *sym, gfc_expr **result)
for (comp = sym->components; comp; comp = comp->next)
{
+ if (comp->access == ACCESS_PRIVATE)
+ {
+ private_comp = true;
+ break;
+ }
if (head == NULL)
tail = head = gfc_get_constructor ();
else
@@ -1928,6 +1934,14 @@ gfc_match_structure_constructor (gfc_symbol *sym, gfc_expr **result)
break;
}
+ if (sym->attr.use_assoc
+ && (sym->component_access == ACCESS_PRIVATE || private_comp))
+ {
+ gfc_error ("Structure constructor for '%s' at %C has PRIVATE "
+ "components", sym->name);
+ goto cleanup;
+ }
+
if (gfc_match_char (')') != MATCH_YES)
goto syntax;