This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/54917] [4.7/4.8 Regression] [OOP] TRANSFER on polymorphic variable causes ICE
- From: "janus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 13 Oct 2012 21:52:39 +0000
- Subject: [Bug fortran/54917] [4.7/4.8 Regression] [OOP] TRANSFER on polymorphic variable causes ICE
- Auto-submitted: auto-generated
- References: <bug-54917-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54917
--- Comment #8 from janus at gcc dot gnu.org 2012-10-13 21:52:39 UTC ---
The following fixes the ICE(s) on comment 5 ...
Index: gcc/fortran/target-memory.c
===================================================================
--- gcc/fortran/target-memory.c (revision 192392)
+++ gcc/fortran/target-memory.c (working copy)
@@ -121,6 +121,7 @@ gfc_target_expr_size (gfc_expr *e)
case BT_HOLLERITH:
return e->representation.length;
case BT_DERIVED:
+ case BT_CLASS:
{
/* Determine type size without clobbering the typespec for ISO C
binding types. */
@@ -572,6 +573,9 @@ gfc_target_interpret_expr (unsigned char *buffer,
gfc_interpret_character (buffer, buffer_size, result);
break;
+ case BT_CLASS:
+ result->ts = result->ts.u.derived->components->ts;
+ /* Fall through. */
case BT_DERIVED:
result->representation.length =
gfc_interpret_derived (buffer, buffer_size, result);
... which is then rejected with:
copy = transfer(1,arg)
1
Error: Variable must not be polymorphic in intrinsic assignment at (1) - check
that there is a matching specific subroutine for '=' operator
Intrinsic assignment to polymorphic variables is an F08 feature, which is not
yet implemented in gfortran, cf. PR 43366.