Stack overflow with stdcall and transfer

N.M. Maclaren nmm1@cam.ac.uk
Wed Jul 28 20:03:00 GMT 2010


On Jul 28 2010, Andrew Pinski wrote:
>>
>> If it fails with a program that contains nothing except Fortran 
>> intrinsics, then I regard that as a bug.  If gfortran doesn't support 
>> -mrtd together with its own intrinsics, then it should diagnose -mtrd 
>> and stop.  If that applies only to certain intrinsics then, ideally, it 
>> should do that just for them.
>
>It works if you compile the gfortran library with -mrtd.  This is just
>like compiling some C code that only uses standard C functions with
>-mrtd and thinking it will work.  -mrtd changes the ABI which is being
>used, just like -malign-double and some of the other -m* options.
>There is already a big warning in the manual:
>@strong{Warning:} this calling convention is incompatible with the one
>normally used on Unix, so you cannot use it if you need to call
>libraries compiled with the Unix compiler.
>
>So I guess you did not follow the warning :).

You have misunderstood my point.  The intrinsics are part of the Fortran
language, and it is a shoddy implementation that expects end programmers
to know how the implementation is divided.  Also, there are well-known
(well, to us old fogies, anyway) techniques for diagnosing such mistakes.
If the compiler is using a set of intrinsics not compiled with that option,
then it should reject the option with maximum prejudice!

And it wasn't me wot did it :-)

Regards,
Nick Maclaren.



More information about the Fortran mailing list