[PATCH, part1] Fortran: various fixes for STAT/LSTAT/FSTAT intrinsics [PR82480]

Harald Anlauf anlauf@gmx.de
Wed Jun 11 20:18:37 GMT 2025


Dear all,

the attached patch is a first attempt to fix some issues with the GNU
intrinsics STAT/LSTAT/FSTAT which are g77 heritage.  This patch is
preparatory for dealing with the issue reported in PR82480 in that
the default version of theses intrinsics use INTEGER(KIND=4) results
that may overflow, unless -fdefault-integer-8 is used.

This patch consists of the following parts:

- correct keyword names from g77 to gfortran implementation and manual

- enhance checking of INTENT(OUT) arguments (VALUES, STATUS)

- correct error messages in runtime library

- for simplicity, variables have been consistently renamed in the
   present context ("array" -> "values").

- for the INTEGER(KIND=4) versions the STATUS returns ERANGE if
   an overflow is encountered.

The latter is certainly debatable, as one of the existing testcases
stat_{1,2}.f90 may fail on systems where e.g. an inode number is larger
than INT32_MAX may occur.  Options are to drop the overflow check, or
to run those testcases with additional option -fdefault-integer-8.

Opinions?

Otherwise regtests here on x86_64-pc-linux-gnu without issues.
OK for mainline?

Thanks,
Harald

-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr82480-part1.diff
Type: text/x-patch
Size: 28988 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/fortran/attachments/20250611/b2228bd9/attachment-0003.bin>


More information about the Fortran mailing list