PR fortran/34438
* resolve.c (resolve_symbol): Do not emit public-variable-
of-private-derived-type error for non-module variables.
2007-12-14 Tobias Burnus <burnus@net-b.de>
PR fortran/34438
* gfortran.dg/private_type_10.f90: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@130933
138bc75d-0d04-0410-961f-
82ee72b054a4
2007-12-14 Tobias Burnus <burnus@net-b.de>
+ PR fortran/34438
+ * resolve.c (resolve_symbol): Do not emit public-variable-
+ of-private-derived-type error for non-module variables.
+
+2007-12-14 Tobias Burnus <burnus@net-b.de>
+
PR fortran/34398
* expr.c (gfc_check_assign): Add range checks for assignments of BOZs.
* resolve.c (resolve_ordinary_assign): Ditto.
See 4.4.1 (F95) and 4.5.1.1 (F2003); and related interpretation
161 in 95-006r3. */
if (sym->ts.type == BT_DERIVED
+ && sym->ns->proc_name && sym->ns->proc_name->attr.flavor == FL_MODULE
+ && !sym->ts.derived->attr.use_assoc
&& gfc_check_access (sym->attr.access, sym->ns->default_access)
&& !gfc_check_access (sym->ts.derived->attr.access,
sym->ts.derived->ns->default_access)
- && !sym->ts.derived->attr.use_assoc
&& gfc_notify_std (GFC_STD_F2003, "Fortran 2003: PUBLIC %s '%s' at %L "
"of PRIVATE derived type '%s'",
(sym->attr.flavor == FL_PARAMETER) ? "parameter"
2007-12-14 Tobias Burnus <burnus@net-b.de>
+ PR fortran/34438
+ * gfortran.dg/private_type_10.f90: New.
+
+2007-12-14 Tobias Burnus <burnus@net-b.de>
+
PR fortran/34398
* gfortran.dg/nan_4.f90: New.
--- /dev/null
+! { dg-do compile }
+! { dg-options "-std=f95" }
+!
+! PR fortran/34438
+!
+! Check that error is not issued for local, non-module
+! variables.
+!
+! Contributed by Sven Buijssen
+!
+module demo
+ implicit none
+ private
+ type myint
+ integer :: bar = 42
+ end type myint
+ public :: func
+contains
+ subroutine func()
+ type(myint) :: foo
+ end subroutine func
+end module demo
+
+module demo2
+ implicit none
+ private
+ type myint
+ integer :: bar = 42
+ end type myint
+ type(myint), save :: foo2 ! { dg-error "of PRIVATE derived type" }
+ public :: foo2
+end module demo2
+
+! { dg-final { cleanup-modules "demo" } }