Patch, Fortran] FINAL (prep patches 5/5): Activate the generation of the finalization wrapper

Tobias Burnus
Mon Dec 31 12:40:00 GMT 2012

(Patch 4/5, which adds support for noncontiguous arrays to the 
finalization wrapper follows soon; it works, but I should do a small 
cleanup before submittal.)

Contrary to the other patches in this series, this patch changes the 
generated code - and it changes the ABI. With this patch, the virtual 
table (vtab) gets a "_final" components between _copy and the user's 
type-bound procedures. Additionally, the finalization wrapper is generated.

Note: This patch only adds the finalization wrapper function - it does 
not use it. Thus, there is no user-visible benefit of this patch - 
except for the avoided 4.9 ABI issue.

The risk of this patch is rather low (only ICEs are possible).

The (only? main?) advantage of this patch is that it avoids ABI breakage 
for polymorphic variables immediately after branching 4.8. (Due to two 
recent patches, we have already broken the ABI for 4.8 and bumped the 
.mod version. Thus, this breakage could make use of the already bumped 
.mod file version number.)

Build and regtested on x86-64-gnu-linux.
OK for the 4.8 trunk? – Alternatively: OK for the 4.9 trunk?

* * *

The next step is make use of the finalization wrapper for both calling 
the user's finalization subroutines but also for deallocating 
allocatable components of polymorphic variables/components. 
("polymorphic freeing").

At I have a draft 
patch which handles some of the cases; however, the support is 
incomplete and there are possibly some issues.

One could consider supporting some subset of polymorphic freeing or 
finalization using the user's FINAL subroutines even for 4.8. However, 
it looks more like GCC 4.9 material. Comments?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: final-gen-wrapper.diff
Type: text/x-patch
Size: 1007 bytes
Desc: not available
URL: <>

More information about the Gcc-patches mailing list