[PATCH] Fortran: ABI for scalar CHARACTER(LEN=1),VALUE dummy argument [PR110360]
Mikael Morin
morin-mikael@orange.fr
Fri Jun 23 08:04:49 GMT 2023
Le 22/06/2023 à 22:23, Harald Anlauf via Fortran a écrit :
> Dear all,
>
> gfortran's ABI specifies that actual arguments to CHARACTER(LEN=1),VALUE
> dummy arguments are passed by value in the scalar case. That did work
> for constant strings being passed, but not in several other cases, where
> pointers were passed, resulting in subsequent random junk...
>
> The attached patch fixes this for the case of a non-constant string
> argument.
>
> It does not touch the character,value bind(c) case - this is a different
> thing and may need separate work, as Mikael pointed out - and there is
> a missed optimization for the case of actual constant string arguments
> of length larger than 1: it appears that the full string is pushed to
> the stack. I did not address that, as the primary aim here is to get
> correctly working code. (I added a TODO in a comment.)
>
> Regtested on x86_64-pc-linux-gnu. OK for mainline?
>
OK, thanks.
> Thanks,
> Harald
>
More information about the Fortran
mailing list