This is the mail archive of the
mailing list for the GCC project.
Re: [Patch, Fortran] PR56845 - Fix setting of vptr of CLASS(...),SAVE,ALLOCATABLE
- From: Janus Weil <janus at gcc dot gnu dot org>
- To: Tobias Burnus <burnus at net-b dot de>
- Cc: gcc patches <gcc-patches at gcc dot gnu dot org>, gfortran <fortran at gcc dot gnu dot org>
- Date: Fri, 12 Apr 2013 00:05:44 +0200
- Subject: Re: [Patch, Fortran] PR56845 - Fix setting of vptr of CLASS(...),SAVE,ALLOCATABLE
- References: <5161B4E2 dot 1030206 at net-b dot de>
> 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?