This is the mail archive of the gcc-patches@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]

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


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


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