[PATCH] Fortran: make STAT/LSTAT/FSTAT intrinsics generic [PR82480]

Harald Anlauf anlauf@gmx.de
Tue Sep 9 18:49:51 GMT 2025


Hi Jerry!

Am 08.09.25 um 23:56 schrieb Jerry D:
> On 9/8/25 12:59 PM, Harald Anlauf wrote:
>> Dear all,
>>
>> this is the second (and hopefully final) patch to fix this PR for good.
>> This makes the GNU intrinsics STAT/LSTAT/FSTAT almost generic, with few
>> restrictions:
>>
>> - for the VALUES argument we will support only kinds 4 and 8.
>>    This allows to stay with the current runtime library functions
>>    in libgfortran.  Other arguments will be converted suitably.
>>
>> - a STATUS argument shall have a decimal exponent range of at
>>    least four.  This allows to handle both common errno values
>>    as well as potential LIBERROR_* from libgfortran.h.
>>
>> The hard part was getting this optional,intent(out) STATUS
>> argument right when we want to allow kind conversions,
>> and the actual argument being an optional dummy.
>>
>> In its current version, gfc_conv_procedure_call does not seem
>> to support such trickery, so I wrote a specialized version
>> handling this.  It is actually more complex than it needs
>> to be, as the related runtime library functions do not
>> change their behavior depending on the presence of the
>> actual argument.  We'll generate a temporary of the needed
>> kind, pass a suitable pointer, and assign the result only
>> when it should happen.
>>
>> (Maybe the required feature is already mostly implemented,
>> but I just did not see it.)
>>
>> Regtested on x86_64-pc-linux-gnu.  OK for mainline?
>>
>> Thanks,
>> Harald
>>
> 
> Reviewed, applied, regression checked here OK.
> 
> make info has no errors and the generated info file looks good.

Thanks for the review and full testing!

Pushed as r16-3724-g52d754a1a620ef.

Harald

> OK for mainline.
> 
> Thanks for the work!
> 
> Jerry
> 



More information about the Fortran mailing list