On Wed, Jun 11, 2025 at 10:18:37PM +0200, Harald Anlauf wrote:
> 
> 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?
> 

Thanks for doing these types of cleanups.

You may want to take a peek at 

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=30372

where I posted a few cleanups for SLEEP, UMASK, UNLINK,
etc.  In those cleanups, I would cast arguments to 
integer(4) if I could (ie., if I know the arg was in range)
to prevent an explosion in the size of libgfortran.  

I'll need to think about your -fdefault-integer-8 question
for a bit.  Because that option exists and can change 
default integer kind, we'll need *_i4 and *_i8 versions of
the functions in libgfortran.  I suspect we'll need to
run the testcases with -fdefault-integer-8.

If no one approves your patch by Saturday, I'll review.

Reply via email to