[Patch, Fortran] PR34079 - BIND(C) and characters - unneeded character length passed

Tobias Burnus burnus@net-b.de
Fri Nov 16 08:01:00 GMT 2007


:ADDPATCH fortran:

For
   call subroutine("Hello")
gfortran passes two arguments: a pointer to the string and the string
length. For C interoperability the additional argument with the
character length is not needed.

This patch simply does not generate the extra argument(s) when calling a
BIND(C) procedure.

The extra argument is harmless for the standard C calling convention as
the caller pops the stack, however, using STDCALL the called function
has to pop the stack.

STDCALL is used by some 32bit Windows libraries and I don't know how
much this patch will help.
(For STDCALL see -mrdt option in the GCC manual and
http://gcc.gnu.org/ml/fortran/2007-11/msg00074.html )


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

Tobias
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: bind-c-char.diff
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20071116/8e0f78f0/attachment.ksh>


More information about the Fortran mailing list