[Bug fortran/43969] [OOP] ALLOCATED() with polymorphic variables
sfilippone at uniroma2 dot it
gcc-bugzilla@gcc.gnu.org
Sat May 15 11:33:00 GMT 2010
------- Comment #5 from sfilippone at uniroma2 dot it 2010-05-15 11:33 -------
(In reply to comment #4)
> Turns out that fixing this one is completely trivial, once you actually have a
> look at it :)
>
> The ALLOCATED intrinsic was just not adjusted to handle CLASS variables yet.
> The patch is as simple as this:
>
> Index: gcc/fortran/trans-intrinsic.c
> ===================================================================
> --- gcc/fortran/trans-intrinsic.c (revision 159389)
> +++ gcc/fortran/trans-intrinsic.c (working copy)
> @@ -4529,6 +4529,8 @@ gfc_conv_allocated (gfc_se *se, gfc_expr *expr)
> {
> /* Allocatable scalar. */
> arg1se.want_pointer = 1;
> + if (arg1->expr->ts.type == BT_CLASS)
> + gfc_add_component_ref (arg1->expr, "$data");
> gfc_conv_expr (&arg1se, arg1->expr);
> tmp = arg1se.expr;
> }
>
> Thanks for the bug report, Salvatore.
>
While we are at it, shouldn't the error message on ALLOCATE be changed to
reflect the fact that not only arrays but also scalars might be allocatables?
(see #2)
Salvatore
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43969
More information about the Gcc-bugs
mailing list