[Patch, Fortran] PR56845 - Fix setting of vptr of CLASS(...),SAVE,ALLOCATABLE

Janus Weil janus@gcc.gnu.org
Fri Apr 12 07:44:00 GMT 2013


Hi Tobias,

> An unallocated polymorphic variable has the declared type; however, for
> static (SAVE) variables, the current code didn't set the value.
>
> (That the end of scope deallocation/_gfortran_caf_deregister is gone for
> coarrays (declared in the main program) was a side effect. The
> sync/deregistering will still happen via the _gfortran_caf_finalize call.
> But that's fine and in the line of the Fortran standard; in fact, due to the
> FINAL handling, the automatic deallocation of the main program will be also
> removed for nonpolymorphic allocatables.)
>
> Build and regtested on x86-64-gnu-linux.
> OK for the trunk?

Looks basically alright.

Just one minor nit:

+      if (sym->ts.type == BT_CLASS && TREE_STATIC (sym->backend_decl)
+      && CLASS_DATA (sym)->attr.allocatable)

I'd find it somewhat clearer to check for "sym->attr.save" instead of
"TREE_STATIC (sym->backend_decl)", but that may be a matter of taste.

Oh, and can you remind me why this does not need to be done for pointers?

Cheers,
Janus



More information about the Gcc-patches mailing list