[Patch, Fortran] C Binding - module+intrinsic cleanup+bug fixes
Tobias Burnus
tobias.burnus@physik.fu-berlin.de
Sat Mar 23 09:59:00 GMT 2013
Dear all,
initially, I only wanted to allow assumed-rank arrays with C_LOC, even if I played with the idea to cleanup the intrinsic handling of the ISO_C_Binding module for quite some time. But Mikael rejected a hacky version.
The main change of this patch is to move all the special handling of the intrinsics from symbol.c to the normal intrinsics code in intrinsic.{c,h}, check.c, iresolve.c and trans-intrinsics.c. That also implied to do some larger changes to module.c. Additionally, I rewrote all the constraint checks from scratch, based on the Fortran 2003, 2008 and TS29113 standards - and fixed the fallout. Finally, I looked through the bugreports mentioning those intrinsics - and fixed some remaing issues (some were already fixed, either by this patch or since at least GCC 4.6).
Build and regtested on x86-64-gnu-linux.
OK for the trunk?
Follow-up tasks:
* Implement Fortran 2008's IS_CONTIGUOUS intrinsic, add a gfc_is_not_contiguous function (has various use: to simplify that intrinsic, for error checks in c_loc, to make copy-out unconditional etc.). Plus fixing some issues with gfc_is_simply_contiguous (e.g. BT_CLASS is unhandled, but there are more issues). See PR38536, gfortran.dg/c_loc_tests_16.f90 (w/o -std=f2008) and probably more PRs.
* Implement compile-time simplification of (c_)sizeof; required for MPICH. See PR 46641, 36437, 56650
* Cleanup and bug fixes related to BIND(C) procedures, including some of the new TS29113 features and F2008. (Full support requires the new array descriptor)
* Other C binding issues, e.g. having multiple interfaces for the same binding name or fixing binding-name issues with COMMON. And a bunch of other issues, including ICEs.
* New array descriptor / Other TS29113 tasks
(None of those rank top on my to-do list.)
Tobias
PS: What I like about the patch is that it reduces the number of code lines, brings Bind(C) code into line with the rest of gfortran and (hopefully) fixes some bugs, improves diagnostic and lifts some restrictions (new F2008/TS29113 features).
gcc/fortran directory: 16 files changed, 1035 insertions(+), 1417 deletions(-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: c-loc-cleanup.diff
Type: text/x-diff
Size: 142984 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20130323/2f6eaedc/attachment.bin>
More information about the Fortran
mailing list