re PR fortran/50625 ([OOP] ALLOCATABLE attribute lost for module CLASS variables)

2011-10-07  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/50625
	* class.c (gfc_build_class_symbol): Fix whitespace.
	* module.c (mio_symbol): Set 'class_ok' attribute.
	* trans-decl.c (gfc_get_symbol_decl): Make sure the backend_decl has
	been built for class symbols.


2011-10-07  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/50625
	* gfortran.dg/class_46.f03: New.

From-SVN: r179660
This commit is contained in:
Janus Weil 2011-10-07 16:40:14 +02:00
parent 14307a72de
commit 58eba51591
6 changed files with 38 additions and 2 deletions

View File

@ -1,3 +1,11 @@
2011-10-07 Janus Weil <janus@gcc.gnu.org>
PR fortran/50625
* class.c (gfc_build_class_symbol): Fix whitespace.
* module.c (mio_symbol): Set 'class_ok' attribute.
* trans-decl.c (gfc_get_symbol_decl): Make sure the backend_decl has
been built for class symbols.
2011-10-04 Janus Weil <janus@gcc.gnu.org>
PR fortran/35831

View File

@ -188,7 +188,7 @@ gfc_build_class_symbol (gfc_typespec *ts, symbol_attribute *attr,
/* Class container has already been built. */
return SUCCESS;
attr->class_ok = attr->dummy || attr->pointer || attr->allocatable;
attr->class_ok = attr->dummy || attr->pointer || attr->allocatable;
if (!attr->class_ok)
/* We can not build the class container yet. */

View File

@ -3608,6 +3608,8 @@ mio_symbol (gfc_symbol *sym)
mio_symbol_attribute (&sym->attr);
mio_typespec (&sym->ts);
if (sym->ts.type == BT_CLASS)
sym->attr.class_ok = 1;
if (iomode == IO_OUTPUT)
mio_namespace_ref (&sym->formal_ns);

View File

@ -1179,7 +1179,10 @@ gfc_get_symbol_decl (gfc_symbol * sym)
{
gfc_component *c = CLASS_DATA (sym);
if (!c->ts.u.derived->backend_decl)
gfc_find_derived_vtab (c->ts.u.derived);
{
gfc_find_derived_vtab (c->ts.u.derived);
gfc_get_derived_type (sym->ts.u.derived);
}
}
/* All deferred character length procedures need to retain the backend

View File

@ -1,3 +1,8 @@
2011-10-07 Janus Weil <janus@gcc.gnu.org>
PR fortran/50625
* gfortran.dg/class_46.f03: New.
2011-10-06 Joern Rennecke <joern.rennecke@embecosm.com>
* gcc.dg/pr47276.c (ASMNAME, ASMNAME2, STRING): Define.

View File

@ -0,0 +1,18 @@
! { dg-do run }
!
! PR 50625: [4.6/4.7 Regression][OOP] ALLOCATABLE attribute lost for module CLASS variables
!
! Contributed by Tobias Burnus <burnus@gcc.gnu.org>
module m
type t
end type t
class(t), allocatable :: x
end module m
use m
implicit none
if (allocated(x)) call abort()
end
! { dg-final { cleanup-modules "m" } }