This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/57590] [OOP] wrong code with class variables of different shapes


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57590

--- Comment #7 from Mikael Morin <mikael at gcc dot gnu.org> ---
(In reply to janus from comment #5)
> (In reply to janus from comment #4)
> > Will check if this survives a regtest.
> 
> Certainly not! At least we need to check if an as is present at all ...
> 
> 
> Index: gcc/fortran/class.c
> ===================================================================
> --- gcc/fortran/class.c	(revision 201871)
> +++ gcc/fortran/class.c	(working copy)
> @@ -636,7 +636,12 @@ gfc_build_class_symbol (gfc_typespec *ts, symbol_a
>        c->attr.dimension = attr->dimension;
>        c->attr.codimension = attr->codimension;
>        c->attr.abstract = fclass->attr.abstract;
> -      c->as = (*as);
> +      if (*as)
> +	{
> +	  c->as = (*as);
> +	  if (c->as->type == AS_EXPLICIT)
> +	    c->as->type = AS_ASSUMED_SHAPE;
> +	}
>        c->initializer = NULL;
>  
>        /* Add component '_vptr'.  */

Alright, certainly not the grand solution that I had in mind. It defeats the
purpose of specifying array bounds explicitly. On the other hand, as it fixes a
wrong code, not that bad.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]