Hi Tobias, > Small re-diff - but essentially unchanged. > > (I made a thinko when adding a _final call to > gfc_trans_class_array_init_assign: Not in all contexts the _final should be > called, only for INTENT(OUT). Thus, I remove the _final call and deferred it > to the actual finalization call. [That also matches the scalar handling, > which only does a memcpy and no dealloc.]) > > > Build and regtested on x86-64-gnu-linux. > OK for the trunk?
I think this patch is ok. Just one nit: @@ -5571,7 +5569,7 @@ gfc_dump_module (const char *name, int dump_flag) FIXME: For backwards compatibility with the old uncompressed module format, write an extra empty line. When the module version is bumped, this can be removed. */ - gzprintf (module_fp, "GFORTRAN module version '%s' created from %s\n\n", + gzprintf (module_fp, "GFORTRAN module version '%s' created from %s\n", MOD_VERSION, gfc_source_file); Here you should remove the FIXME. Thanks for the patch, Janus > Tobias Burnus wrote: >> >> Pre-remark: This patch does *not* enable finalization or polymorphic >> deallocation. >> >> * * * >> >> Dear all, >> >> The attached patch is a bit boring and invasive, but it paves the way to >> FINAL support. >> >> Changes of technical kind: >> >> * Changed ABI for CLASS's virtual table (due to _final) - and, hence, it >> bumps the .mod version >> * The finalization wrapper is now generated (this should not but might >> lead to ICEs) >> * It also causes that the virtual table is now more often generated >> >> New feature: >> >> _copy no longer deallocates the "dst" argument. Doing so lead to bogus >> finalization with ALLOCATE (exposed with the pending FINAL patch). As a >> sideeffect, memset could be removed and CALLOC could be replased by MALLOC >> (minute performance advantage). In order to keep the deallocation in >> gfc_trans_class_array_init_assign, there is now a call to the finalization >> wrapper. >> >> Next steps: >> * Add end-of-scope/intent(out) deallocation for polymorphic arrays >> * Enable FINAL parsing >> * Stepwise enabling for polymorphic deallocation/finalization >> * Fix issues with ELEMENTAL(+optional) with intent(out) >> * Fix some issues related to intrinsic assignment >> * Fix fallout of any of those items >> >> Build and regtested on x86-64-gnu-linux. >> OK for the trunk? >> >> Tobias