+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
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"
--- /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" } }