This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/51970] [OOP] gimplification failed for polymorphic MOVE_ALLOC
- From: "burnus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 24 Jan 2012 15:27:43 +0000
- Subject: [Bug fortran/51970] [OOP] gimplification failed for polymorphic MOVE_ALLOC
- Auto-submitted: auto-generated
- References: <bug-51970-4@http.gcc.gnu.org/bugzilla/>
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;