From cbb9a26e0ae9d2e8844724df88f4056f6bee3429 Mon Sep 17 00:00:00 2001 From: Janus Weil Date: Mon, 11 May 2009 16:14:38 +0200 Subject: re PR fortran/40089 (Public type with public component which has a private type) 2009-05-11 Janus Weil PR fortran/40089 * resolve.c (resolve_fl_derived): Only return FAILURE if gfc_notify_std fails. 2009-05-11 Janus Weil PR fortran/40089 * gfortran.dg/proc_ptr_comp_7.f90: New. From-SVN: r147379 --- gcc/fortran/ChangeLog | 6 ++++ gcc/fortran/resolve.c | 14 ++++------ gcc/testsuite/ChangeLog | 5 ++++ gcc/testsuite/gfortran.dg/proc_ptr_comp_7.f90 | 40 +++++++++++++++++++++++++++ 4 files changed, 57 insertions(+), 8 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/proc_ptr_comp_7.f90 (limited to 'gcc') diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 97f56b2..d79ea17 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2009-05-11 Janus Weil + + PR fortran/40089 + * resolve.c (resolve_fl_derived): Only return FAILURE if + gfc_notify_std fails. + 2009-05-10 Ian Lance Taylor * gfortran.h (enum gfc_omp_sched_kind): New enum, broken out of diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 34cb365..29d4b3a 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -9086,14 +9086,12 @@ resolve_fl_derived (gfc_symbol *sym) && !is_sym_host_assoc (c->ts.derived, sym->ns) && !c->ts.derived->attr.use_assoc && !gfc_check_access (c->ts.derived->attr.access, - c->ts.derived->ns->default_access)) - { - gfc_notify_std (GFC_STD_F2003, "Fortran 2003: the component '%s' " - "is a PRIVATE type and cannot be a component of " - "'%s', which is PUBLIC at %L", c->name, - sym->name, &sym->declared_at); - return FAILURE; - } + c->ts.derived->ns->default_access) + && gfc_notify_std (GFC_STD_F2003, "Fortran 2003: the component '%s' " + "is a PRIVATE type and cannot be a component of " + "'%s', which is PUBLIC at %L", c->name, + sym->name, &sym->declared_at) == FAILURE) + return FAILURE; if (sym->attr.sequence) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1ccd97a..f8365a0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2009-05-11 Janus Weil + + PR fortran/40089 + * gfortran.dg/proc_ptr_comp_7.f90: New. + 2009-05-11 Ira Rosen PR tree-optimization/40074 diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_comp_7.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_comp_7.f90 new file mode 100644 index 0000000..860c2dd --- /dev/null +++ b/gcc/testsuite/gfortran.dg/proc_ptr_comp_7.f90 @@ -0,0 +1,40 @@ +! { dg-do compile } +! +! PR 40089: Public type with public component which has a private type +! +! Original test case by Juergen Reuter +! Adapted by Janus Weil + +module m + + implicit none + private + + public :: public_t + + type :: private_t + integer :: i + end type + + type :: public_t + type(private_t), pointer :: public_comp_with_private_type + procedure(ifc) , nopass, pointer :: ppc + end type + + abstract interface + integer function ifc () + end function + end interface + +end module m + +program test +use m +implicit none +type(public_t) :: x +integer :: j +j = x%ppc() +end + +! { dg-final { cleanup-modules "m" } } + -- cgit v1.1