On Sat, Oct 19, 2024 at 05:38:30PM +0000, Wyche, George G                       
     PW wrote:
> 
> My Fortran project is based on -std=f2008. The  GNU Fortran (For GCC version 
> 15.0.0) manual's 8.260 STAT example does not link if -std=f2008 is on the 
> command line: gfortran -std=f2008 test_stat.f90; ./a.out
> The ld error is "undefined reference to `stat_'"
> 
> This is with gfortran -version 12.2.0 and ld -version 2.40
> 
> Removing -std=f2008, and the example works as expected.
> 

FX has already addressed the questions.  Here's the 
F2023 standardese about the issue:

   A standard-conforming processor may allow additional forms and
   relationships provided that such additions do not conflict with the
   standard forms and relationships.  However, a standard-conforming
   processor may allow additional intrinsic procedures even though this
   could cause a conflict with the name of a procedure in a standard-
   conforming program.  If such a conflict occurs and involves the name
   of an external procedure, the processor is permitted to use the
   intrinsic procedure unless the name has the EXTERNAL attribute (8.5.9)
   where it is used.  A standard-conforming program shall not use
   nonstandard intrinsic procedures or modules that have been added
   by the processor.

Note the last sentence.  STAT() is nonstandard intrinsic procedure.
You used -std=f2008, which causes gfortran to ignore all such
procedure unless the -fall-intrinsics option is used.
-- 
Steve

Reply via email to