[Bug fortran/56149] 64 bit gFortran-C interop hidden character argument length passed as 32 bit value

paul.laidler at ntlworld dot com gcc-bugzilla@gcc.gnu.org
Wed Jan 30 19:58:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56149

--- Comment #2 from Paul Laidler <paul.laidler at ntlworld dot com> 2013-01-30 19:58:27 UTC ---
Hi

Many thanks for your reply and interest.

The ClearWin+ function winio@ (winio$ in gFortran) emulates the C function
printf that takes a format string then a variable number of arguments
depending on the content of the format. The function can be programmed in C
on the basis that all arguments are passed as 64 bit addresses until you
get to the length of the format string which has a size well below the
minimum possible address value. Any arguments after that will also be
string lengths. The format string cannot be processed to find out what
arguments are supplied until we know its length.

The 32 bit length values are passed correctly by gFortran but occupy 64
bits on  the stack. However, the HIDWORD is not currently set and will
contain whatever is left from its previous use. Nor do we have a null
terminator to calculate the length of the format string directly unless the
programmer supplies one.

Large amounts of code has been written by our users, some of whom are
looking to port to gFortran in the absence of 64 bit FTN95 (the Silverfrost
Fortran compiler). Hence the interest is porting the ClearWin+ library to a
64 bit DLL that is accessible from gFortran code.

Any help or insight that you have would be greatly appreciated.

Paul Laidler


On 30 January 2013 16:22, kargl at gcc dot gnu.org <gcc-bugzilla@gcc.gnu.org
> wrote:

>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56149
>
> kargl at gcc dot gnu.org changed:
>
>            What    |Removed                     |Added
>
> ----------------------------------------------------------------------------
>            Priority|P3                          |P5
>                  CC|                            |kargl at gcc dot gnu.org
>
> --- Comment #1 from kargl at gcc dot gnu.org 2013-01-30 16:22:57 UTC ---
> Do you have a small self-contained example and
> the command lines you use to compile the code?
>
> The hidden string length is a 32-bit integer.
> It will always be a 32-bit integer, so I do
> not see how it can be confused for a 64-bit
> address.
>
> --
> Configure bugmail: http://gcc.gnu.org/bugzilla/userprefs.cgi?tab=email
> ------- You are receiving this mail because: -------
> You reported the bug.
>



More information about the Gcc-bugs mailing list