[Patch,Fortran] PR40898 - Fix passing strings with STDCALL aand BIND(C)

Tobias Burnus burnus@net-b.de
Wed Jul 29 14:00:00 GMT 2009


When passing strings, gfortran appends a hidden argument with
the string length. Using BIND(C), that should not happen. It
was fixed for the generation of the call and when when generating
a function, but for external functions (with interface), this
change was forgotten.

The practical consequence was very little (TREE_DECL <-> call
inconsistency), except for Windows with STDCALL as there the
function calls are decorated by @<n> (n = argument size to pop
off the stack).

For the return value there is no problem as this is already
dealt with (return by argument == false).


The change in trans-decl.c was detected when running the
testsuite. I am not sure whether the attr.entry_master check
is needed, but in any case the master function should have
character length arguments, when any of its associated entry
procedures does not have BIND(C). (Always present is easier
than checking all other functions for being bind(C).)


Build and regtested on x86-64-linux. FX successfully tested
the test case of the PR (with the trans-type.c patch only)
a cross compiler (see PR). OK for the trunk?

Tobias

PS: I have not included a test case; if someone thinks, we can
add a Window-only one doing a link test.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: stdcall6.diff
Type: text/x-patch
Size: 1427 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20090729/dee67423/attachment.bin>


More information about the Gcc-patches mailing list