Message ID | AANLkTimC8Bbke91o+26JhdpJR6fapn-3OH+tTn0=ASJz@mail.gmail.com |
---|---|
State | New |
Headers | show |
Hello Janus, Janus Weil wrote: > the attached patch fixes the subject line PR by making > 'gfc_default_initializer' handle CLASS components properly. Regtested > on x86_64-unknown-linux-gnu. Ok for trunk? OK. Thanks for the patch. Note: The ICE mentioned in comment 1 is still present. (Add "(:)" to "indxmap" in the example in comment 1. The scalar version compiles and the wrong-code issue is fixed with your patch; the array version still gives the internal compiler error.) Tobias > 2010-12-28 Janus Weil<janus@gcc.gnu.org> > > PR fortran/46838 > * expr.c (gfc_default_initializer): Handle allocatable CLASS components. > > > 2010-12-28 Janus Weil<janus@gcc.gnu.org> > > PR fortran/46838 > * gfortran.dg/alloc_comp_class_2.f90: New.
Hi Tobias, >> the attached patch fixes the subject line PR by making >> 'gfc_default_initializer' handle CLASS components properly. Regtested >> on x86_64-unknown-linux-gnu. Ok for trunk? > > OK. Thanks for the patch. thanks for reviewing. Committed as r168322. > Note: The ICE mentioned in comment 1 is still present. (Add "(:)" to > "indxmap" in the example in comment 1. The scalar version compiles and the > wrong-code issue is fixed with your patch; the array version still gives the > internal compiler error.) I know, but there is simply such an amount of scalar-OOP bugs that I'm not even thinking about starting anything related to polymorphic arrays (which most probably means that array OOP will basically be unsupported in the 4.6 release ...) Cheers, Janus >> 2010-12-28 Janus Weil<janus@gcc.gnu.org> >> >> PR fortran/46838 >> * expr.c (gfc_default_initializer): Handle allocatable CLASS >> components. >> >> >> 2010-12-28 Janus Weil<janus@gcc.gnu.org> >> >> PR fortran/46838 >> * gfortran.dg/alloc_comp_class_2.f90: New. > >
Index: gcc/fortran/expr.c =================================================================== --- gcc/fortran/expr.c (revision 168293) +++ gcc/fortran/expr.c (working copy) @@ -3648,7 +3648,8 @@ gfc_default_initializer (gfc_typespec *ts) /* See if we have a default initializer in this, but not in nested types (otherwise we could use gfc_has_default_initializer()). */ for (comp = ts->u.derived->components; comp; comp = comp->next) - if (comp->initializer || comp->attr.allocatable) + if (comp->initializer || comp->attr.allocatable + || (comp->ts.type == BT_CLASS && CLASS_DATA (comp)->attr.allocatable)) break; if (!comp) @@ -3665,7 +3666,8 @@ gfc_default_initializer (gfc_typespec *ts) if (comp->initializer) ctor->expr = gfc_copy_expr (comp->initializer); - if (comp->attr.allocatable) + if (comp->attr.allocatable + || (comp->ts.type == BT_CLASS && CLASS_DATA (comp)->attr.allocatable)) { ctor->expr = gfc_get_expr (); ctor->expr->expr_type = EXPR_NULL;