]> git.ipfire.org Git - thirdparty/gcc.git/commit
Fortran: make STAT/LSTAT/FSTAT intrinsics generic [PR82480]
authorHarald Anlauf <anlauf@gmx.de>
Mon, 8 Sep 2025 19:21:15 +0000 (21:21 +0200)
committerHarald Anlauf <anlauf@gmx.de>
Tue, 9 Sep 2025 16:11:24 +0000 (18:11 +0200)
commit52d754a1a620efdbfe4873ae177a62433be4e4d9
tree63f38d59dc5f76dd432842afda97deae0bdf9c2a
parent50efa788a4b6c7f619101b6156b47b91124c6dd3
Fortran: make STAT/LSTAT/FSTAT intrinsics generic [PR82480]

PR fortran/82480

gcc/fortran/ChangeLog:

* check.cc (error_unsupported_kind): Helper function to report an
unsupported kind of an argument.
(check_minrange4): Helper function to report if an integer variable
does not have a decimal range of at least four.
(gfc_check_fstat): Adjust checks for generalization of instrinsic
function FSTAT.
(gfc_check_fstat_sub): Likewise for subroutine FSTAT.
(gfc_check_stat): Likewise for functio STAT.
(gfc_check_stat_sub): Likewise for subroutine STAT.
* intrinsic.texi: Document generalized versions of intrinsics
STAT/LSTAT/FSTAT.
* iresolve.cc (gfc_resolve_stat): STAT function result shall have
the same kind as the VALUES argument.
(gfc_resolve_lstat): Likewise for LSTAT.
(gfc_resolve_fstat): Likewise for FSTAT.
(gfc_resolve_stat_sub): Resolve proper library subroutine for STAT.
(gfc_resolve_lstat_sub): Likewise for LSTAT.
* trans-decl.cc (gfc_build_intrinsic_function_decls): Declare
fndecls for required subroutines in runtine library.
* trans-intrinsic.cc (conv_intrinsic_fstat_lstat_stat_sub): Emit
runtime wrapper code for the library functions, taking care of
possible kind conversion of the optional STATUS argument of the
subroutine versions of the intrinsics.
(gfc_conv_intrinsic_subroutine): Use it.
* trans.h (GTY): Declare prototypes.

gcc/testsuite/ChangeLog:

* gfortran.dg/stat_3.f90: Extend argument checking.
* gfortran.dg/stat_4.f90: New test.
gcc/fortran/check.cc
gcc/fortran/intrinsic.texi
gcc/fortran/iresolve.cc
gcc/fortran/trans-decl.cc
gcc/fortran/trans-intrinsic.cc
gcc/fortran/trans.h
gcc/testsuite/gfortran.dg/stat_3.f90
gcc/testsuite/gfortran.dg/stat_4.f90 [new file with mode: 0644]