[Patch, Fortran] PR34079 - Remove string length arguments for bind(c) procedures

Tobias Burnus burnus@net-b.de
Wed Nov 21 21:22:00 GMT 2007


:ADDPATCH fortran:

The string length in bind(C) procedures is always one
("character(len=1)") thus it does not need to be passed as argument to
the procedure. This patch removes the extra argument from both the
procedure call and from the procedure declaration.

I keep the arguments in the ENTRY master function as one can mix bind(C)
and not-bind(C); and as a bind(C) and a non-bind(C) procedure can share
an argument, this seems to be more natural.

Except of the file name, the patch for calling the procedure should be
identical to the patch at
http://gcc.gnu.org/ml/gcc-patches/2007-11/msg00851.html

Build and regression tested on x86-64. OK for the trunk?

Tobias

PS: If you wonder how to pass strings to bind(C) procedures if len=1:
Simply use arrays, e.g.

   character(len=1, kind=c_char), dimension(*) :: str

The procedure can then be called as  "call sub(["a","b","c",
C_NULL_CHAR])" or more conveniently 'call sub("abc"//C_NULL_CHAR)'.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: bind-c-char-args.diff
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20071121/6d3f5c16/attachment.ksh>


More information about the Gcc-patches mailing list