http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51970
--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-01-24 15:27:43 UTC --- Created attachment 26443 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26443 Draft patch for trans-intrinsic.c There are two issues: a) from_expr->rank *and* to_expr->rank are 0 instead of 1. That's a variant of the issue of PR 51977. b) trans-intrinsic.c's conv_move_alloc does not properly handle polymorphic arrays. For (b) a draft patch is attached. TODO: Regtest it, try combinations of TYPE and CLASS, try CLASS with allocatable components - and CLASS components. To use it, you need to either fix issue (a) or you can try the following hack: --- a/gcc/fortran/check.c +++ b/gcc/fortran/check.c @@ -2726,0 +2727,5 @@ gfc_check_move_alloc (gfc_expr *from, gfc_expr *to) + /* THIS IS A HACK! */ + if (from->ts.type == BT_CLASS && CLASS_DATA (from)->attr.dimension) + from->rank = CLASS_DATA (from)->as->rank; + if (to->ts.type == BT_CLASS && CLASS_DATA (to)->attr.dimension) + to->rank = CLASS_DATA (to)->as->rank;