This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Tobias Burnus wrote:
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?

Ok, thanks for the patch!


PS: I have not included a test case; if someone thinks, we can
add a Window-only one doing a link test.

I always like testing as much as possible, but I think here we can go without; I leave this open to you.


Yours,
Daniel


-- Done: Arc-Bar-Cav-Ran-Rog-Sam-Tou-Val-Wiz To go: Hea-Kni-Mon-Pri


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]