diff mbox

[Fortran,OOP] PR 50625: [4.6/4.7 Regression] ALLOCATABLE attribute lost for module CLASS variables

Message ID CAKwh3qjUncH9b_qqbNAQ-xEFpXS=v5-yDd7NYNJZz5Rmb9WV3A@mail.gmail.com
State New
Headers show

Commit Message

Janus Weil Oct. 7, 2011, 10:18 a.m. UTC
Hi all,

here is a small patch for an OOP regression. The title of the PR is a
bit misleading, since it's actually not the ALLOCATABLE attribute
which gets lost, but the 'class_ok' attribute, which we use for
checking if a class declaration is valid. When reading class variables
from a module, we can just set this attribute to '1' (if there was an
error, it would have been caught earlier).

Moreover there was a slight problem with backend_decl's not being
present for class symbols, which is being fixed by the hunk in
trans-decl.c.

Regtested successfully on x86_64-unknown-linux-gnu (except for failure
on entry_4 and select_type_12, which are known middle-end
regressions). Ok for trunk and 4.6?

Cheers,
Janus


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.

Comments

Tobias Burnus Oct. 7, 2011, 10:33 a.m. UTC | #1
On 10/07/2011 12:18 PM, Janus Weil wrote:
> Regtested successfully on x86_64-unknown-linux-gnu (except for failure
> on entry_4 and select_type_12, which are known middle-end
> regressions). Ok for trunk and 4.6?

OK. Thanks for the patch - and for telling me that select_type_12 is a 
middle end regression (PR 50640); I already wondered why my being 
worked-on patch showed all of a sudden that failure. (I had self-caused 
select type failures before; thus, I didn't think of a ME problem.)

Tobias

> 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.
Janus Weil Oct. 7, 2011, 2:45 p.m. UTC | #2
>> Regtested successfully on x86_64-unknown-linux-gnu (except for failure
>> on entry_4 and select_type_12, which are known middle-end
>> regressions). Ok for trunk and 4.6?
>
> OK. Thanks for the patch

Thanks for the review. Committed to trunk as r179660.


> - and for telling me that select_type_12 is a
> middle end regression (PR 50640); I already wondered why my being worked-on
> patch showed all of a sudden that failure. (I had self-caused select type
> failures before; thus, I didn't think of a ME problem.)

Yeah, at first I also thought that my local modifications were to
blame. But then I noticed that it only fails with optimization (which
is usually a very reliable sign for a middle-end problem) and that
Dominique had already filed a PR.

Cheers,
Janus



>> 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.
>
>
Janus Weil Oct. 7, 2011, 9:06 p.m. UTC | #3
2011/10/7 Janus Weil <janus@gcc.gnu.org>:
>>> Regtested successfully on x86_64-unknown-linux-gnu (except for failure
>>> on entry_4 and select_type_12, which are known middle-end
>>> regressions). Ok for trunk and 4.6?
>>
>> OK. Thanks for the patch
>
> Thanks for the review. Committed to trunk as r179660.

... and to the 4.6 branch as r179696.

Cheers,
Janus



>>> 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.
>>
>>
>
diff mbox

Patch

Index: gcc/fortran/class.c
===================================================================
--- gcc/fortran/class.c	(revision 179647)
+++ gcc/fortran/class.c	(working copy)
@@ -188,7 +188,7 @@  gfc_build_class_symbol (gfc_typespec *ts, symbol_a
     /* 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.  */
Index: gcc/fortran/module.c
===================================================================
--- gcc/fortran/module.c	(revision 179647)
+++ gcc/fortran/module.c	(working copy)
@@ -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);
Index: gcc/fortran/trans-decl.c
===================================================================
--- gcc/fortran/trans-decl.c	(revision 179647)
+++ gcc/fortran/trans-decl.c	(working copy)
@@ -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