re PR fortran/40089 (Public type with public component which has a private type)

2009-05-11  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/40089
	* resolve.c (resolve_fl_derived): Only return FAILURE if
	gfc_notify_std fails.


2009-05-11  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/40089
	* gfortran.dg/proc_ptr_comp_7.f90: New.

From-SVN: r147379
This commit is contained in:
Janus Weil 2009-05-11 16:14:38 +02:00
parent df398a3708
commit cbb9a26e0a
4 changed files with 57 additions and 8 deletions

View file

@ -1,3 +1,9 @@
2009-05-11 Janus Weil <janus@gcc.gnu.org>
PR fortran/40089
* resolve.c (resolve_fl_derived): Only return FAILURE if
gfc_notify_std fails.
2009-05-10 Ian Lance Taylor <iant@google.com>
* gfortran.h (enum gfc_omp_sched_kind): New enum, broken out of

View file

@ -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)
{

View file

@ -1,3 +1,8 @@
2009-05-11 Janus Weil <janus@gcc.gnu.org>
PR fortran/40089
* gfortran.dg/proc_ptr_comp_7.f90: New.
2009-05-11 Ira Rosen <irar@il.ibm.com>
PR tree-optimization/40074

View file

@ -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 <reuter@physik.uni-freiburg.de>
! Adapted by Janus Weil <janus@gcc.gnu.org>
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" } }