[Bug fortran/57590] [OOP] wrong code with class variables of different shapes
janus at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Aug 20 13:07:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57590
--- Comment #4 from janus at gcc dot gnu.org ---
(In reply to janus from comment #3)
> I think in general it's ok to use the same class container type for all of
> them, but we should not fix the array spec of the _data component at compile
> time (but use something like AS_ASSUMED_SHAPE instead?).
In fact the following simple patch makes the test case produce the expected
output:
Index: gcc/fortran/class.c
===================================================================
--- gcc/fortran/class.c (revision 201871)
+++ gcc/fortran/class.c (working copy)
@@ -637,6 +637,8 @@ gfc_build_class_symbol (gfc_typespec *ts, symbol_a
c->attr.codimension = attr->codimension;
c->attr.abstract = fclass->attr.abstract;
c->as = (*as);
+ if (c->as->type == AS_EXPLICIT)
+ c->as->type = AS_ASSUMED_SHAPE;
c->initializer = NULL;
/* Add component '_vptr'. */
Will check if this survives a regtest.
More information about the Gcc-bugs
mailing list