diff options
| author | janus <janus@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-01-19 13:45:07 +0000 |
|---|---|---|
| committer | janus <janus@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-01-19 13:45:07 +0000 |
| commit | 1b4ad9dac6939b8e1e110e51f70625f48f30023a (patch) | |
| tree | 862f8561a7cde35057e44f9c5f3509db7dee40ad /gcc/fortran/symbol.c | |
| parent | 270a54d23107df4f9b7bd64858393e89af094d83 (diff) | |
| download | ppe42-gcc-1b4ad9dac6939b8e1e110e51f70625f48f30023a.tar.gz ppe42-gcc-1b4ad9dac6939b8e1e110e51f70625f48f30023a.zip | |
gcc/fortran/
2010-01-19 Janus Weil <janus@gcc.gnu.org>
PR fortran/42545
* resolve.c (resolve_fl_derived): Set the accessibility of the parent
component for extended types.
* symbol.c (gfc_find_component): Remove a wrongly-worded error message
and take care of parent component accessibility.
gcc/testsuite/
2010-01-19 Janus Weil <janus@gcc.gnu.org>
PR fortran/42545
* gfortran.dg/extends_6.f03: Modified an error message.
* gfortran.dg/extends_10.f03: New test.
* gfortran.dg/private_type_6.f03: Modified an error message.
* gfortran.dg/structure_constructor_8.f03: Ditto.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@156040 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/symbol.c')
| -rw-r--r-- | gcc/fortran/symbol.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c index a5787de04ab..e363c5e2703 100644 --- a/gcc/fortran/symbol.c +++ b/gcc/fortran/symbol.c @@ -1958,23 +1958,17 @@ gfc_find_component (gfc_symbol *sym, const char *name, else if (sym->attr.use_assoc && !noaccess) { - if (p->attr.access == ACCESS_PRIVATE) + bool is_parent_comp = sym->attr.extension && (p == sym->components); + if (p->attr.access == ACCESS_PRIVATE || + (p->attr.access != ACCESS_PUBLIC + && sym->component_access == ACCESS_PRIVATE + && !is_parent_comp)) { if (!silent) gfc_error ("Component '%s' at %C is a PRIVATE component of '%s'", name, sym->name); return NULL; } - - /* If there were components given and all components are private, error - out at this place. */ - if (p->attr.access != ACCESS_PUBLIC && sym->component_access == ACCESS_PRIVATE) - { - if (!silent) - gfc_error ("All components of '%s' are PRIVATE in structure" - " constructor at %C", sym->name); - return NULL; - } } return p; |

