[v4.0.x] Compilation: unknown `FINDLOC` function

,

NEMO 4.2.0 option %FPPFLAGS -P -traditional did not work for me.

I tried several combinations of %FPPFLAGS parameters but it still fails to compile. My architecture arch-ifort_linux_NOI4.fcm works fine with up to NEMO-r4.0.6 but it fails with nemo r4.0.7 and nemo r4.2.0.
Perhaps my ifort is too antique to handle nemo 4.2.0? (intel 2016.3.210)
Or am I doing something else that prevents to compile successfully?
Thanks,

SUCCESS: v4.0.6 with %FPPFLAGS -P -C -traditional
FAIL: v4.0.7 with %FPPFLAGS -P -C -traditional for unknown FINDLOC function

Log
fcm_internal compile:F nemo /data3/ueyoshi/nemo_r4.0.7/cfgs/ORCA2_ICE_PISCES/BLD/ppsrc/nemo/restart.f90 restart.o
mpiifort -c -cpp -o restart.o -I/data3/ueyoshi/nemo_r4.0.7/cfgs/ORCA2_ICE_PISCES/BLD/inc -r8 -O3 -xHost -fp-model source -traceback -I/data1/ueyoshi/local/xios-2.5/inc -I/data1/ue                                    yoshi/local/NDIR_netcdf-c-4.4.1.1/include -I/data1/ueyoshi/local/HDIR_hdf5-1.8.9/include -I/opt/intel/compilers_and_libraries_2016.1.150/linux/mpi/intel64/include -c /data3/ueyosh                                    i/nemo_r4.0.7/cfgs/ORCA2_ICE_PISCES/BLD/ppsrc/nemo/restart.f90
/data3/ueyoshi/nemo_r4.0.7/cfgs/ORCA2_ICE_PISCES/BLD/ppsrc/nemo/restart.f90(116): error #6632: Keyword arguments are invalid without an explicit interface.   [DIM]
            nrst_lst = MAX( 1, FINDLOC( nn_stocklist, nitrst, DIM=1 ) )
--------------------------------------------------------------^
/data3/ueyoshi/nemo_r4.0.7/cfgs/ORCA2_ICE_PISCES/BLD/ppsrc/nemo/restart.f90(116): error #6404: This name does not have a type, and must have an explicit type.   [FINDLOC]
            nrst_lst = MAX( 1, FINDLOC( nn_stocklist, nitrst, DIM=1 ) )
-------------------------------^
/data3/ueyoshi/nemo_r4.0.7/cfgs/ORCA2_ICE_PISCES/BLD/ppsrc/nemo/restart.f90(116): error #6363: The intrinsic data types of the arguments must be the same.   [MAX]
            nrst_lst = MAX( 1, FINDLOC( nn_stocklist, nitrst, DIM=1 ) )
-------------------------------^
compilation aborted for /data3/ueyoshi/nemo_r4.0.7/cfgs/ORCA2_ICE_PISCES/BLD/ppsrc/nemo/restart.f90 (code 1)
fcm_internal compile failed (256)
gmake: *** [restart.o] Error 1
gmake -f /data3/ueyoshi/nemo_r4.0.7/cfgs/ORCA2_ICE_PISCES/BLD/Makefile -j 1 all failed (2) at /data3/ueyoshi/nemo_r4.0.7/ext/FCM/bin/../lib/Fcm/Build.pm line 597.
->Make: 104 seconds
->TOTAL: 119 seconds
Build failed on Tue Mar 22 11:43:10 2022.
/data3/ueyoshi/nemo_r4.0.7/cfgs

FAIL: v4.2.0 with %FPPFLAGS -P -C -traditional for undefined precision kind (space inserted _ sp)

Log
fcm_internal compile:F nemo /data3/ueyoshi/nemo_4.2.0_git2/nemo_4.2.0/cfgs/ORCA2_ICE_PISCES/BLD/ppsrc/nemo/lbcnfd.f90 lbcnfd.o
mpiifort -c -cpp -o lbcnfd.o -I/data3/ueyoshi/nemo_4.2.0_git2/nemo_4.2.0/cfgs/ORCA2_ICE_PISCES/BLD/inc -r8 -O3 -xHost -fp-model source -traceback -I/data1/ueyoshi/local/xios-2.5/inc -I/data1/ueyoshi/local/NDIR_netcdf-c-4.4.1.1/include -I/data1/ueyoshi/local/HDIR_hdf5-1.8.9/include -I/opt/intel/compilers_and_libraries_2016.1.150/linux/mpi/intel64/include -c /data3/ueyoshi/nemo_4.2.0_git2/nemo_4.2.0/cfgs/ORCA2_ICE_PISCES/BLD/ppsrc/nemo/lbcnfd.f90
/data3/ueyoshi/nemo_4.2.0_git2/nemo_4.2.0/cfgs/ORCA2_ICE_PISCES/BLD/ppsrc/nemo/lbcnfd.f90(96): error #5082: Syntax error, found ',' when expecting one of: =
   SUBROUTINE lbc_nfd_ sp( ptab, cd_nat, psgn, khls, kfld )
---------------------------------------^
/data3/ueyoshi/nemo_4.2.0_git2/nemo_4.2.0/cfgs/ORCA2_ICE_PISCES/BLD/ppsrc/nemo/lbcnfd.f90(97): error #5082: Syntax error, found IDENTIFIER 'SP' when expecting one of: ( )
      TYPE(PTR_4d_ sp),  DIMENSION(:), INTENT(inout) ::   ptab        ! pointer of arrays on which apply the b.c.
-------------------^
/data3/ueyoshi/nemo_4.2.0_git2/nemo_4.2.0/cfgs/ORCA2_ICE_PISCES/BLD/ppsrc/nemo/lbcnfd.f90(484): error #5082: Syntax error, found IDENTIFIER 'SP' when expecting one of: <END-OF-STATEMENT> ; <END-OF-FILE>
   END SUBROUTINE lbc_nfd_ sp
---------------------------^
/data3/ueyoshi/nemo_4.2.0_git2/nemo_4.2.0/cfgs/ORCA2_ICE_PISCES/BLD/ppsrc/nemo/lbcnfd.f90(97): error #6818: The statement following a CONTAINS is not a function-stmt or a subroutine-stmt.
      TYPE(PTR_4d_ sp),  DIMENSION(:), INTENT(inout) ::   ptab        ! pointer of arrays on which apply the b.c.
-----------^

FAIL: nemo_4.2.0 with %FPPFLAGS -P -traditional for unknown xios_send_field subroutine

Log
fcm_internal compile:F nemo /data3/ueyoshi/nemo_4.2.0_git2/nemo_4.2.0/cfgs/ORCA2_ICE_PISCES/BLD/ppsrc/nemo/iom.f90 iom.o
mpiifort -c -cpp -o iom.o -I/data3/ueyoshi/nemo_4.2.0_git2/nemo_4.2.0/cfgs/ORCA2_ICE_PISCES/BLD/inc -r8 -O3 -xHost -fp-model source -traceback -I/data1/ueyoshi/local/xios-2.5/inc -I/data1/ueyoshi/local/NDIR_netcdf-c-4.4.1.1/include -I/data1/ueyoshi/local/HDIR_hdf5-1.8.9/include -I/opt/intel/compilers_and_libraries_2016.1.150/linux/mpi/intel64/include -c /data3/ueyoshi/nemo_4.2.0_git2/nemo_4.2.0/cfgs/ORCA2_ICE_PISCES/BLD/ppsrc/nemo/iom.f90
/data3/ueyoshi/nemo_4.2.0_git2/nemo_4.2.0/cfgs/ORCA2_ICE_PISCES/BLD/ppsrc/nemo/iom.f90(1950): error #6285: There is no matching specific subroutine for this generic subroutine call.   [XIOS_SEND_FIELD]
            CALL xios_send_field( cdname, pfield2d, ntile - 1 )
-----------------^
/data3/ueyoshi/nemo_4.2.0_git2/nemo_4.2.0/cfgs/ORCA2_ICE_PISCES/BLD/ppsrc/nemo/iom.f90(1962): error #6285: There is no matching specific subroutine for this generic subroutine call.   [XIOS_SEND_FIELD]
            CALL xios_send_field( cdname, pfield2d, ntile - 1 )
-----------------^
/data3/ueyoshi/nemo_4.2.0_git2/nemo_4.2.0/cfgs/ORCA2_ICE_PISCES/BLD/ppsrc/nemo/iom.f90(1974): error #6285: There is no matching specific subroutine for this generic subroutine call.   [XIOS_SEND_FIELD]
            CALL xios_send_field( cdname, pfield3d, ntile - 1 )
-----------------^
/data3/ueyoshi/nemo_4.2.0_git2/nemo_4.2.0/cfgs/ORCA2_ICE_PISCES/BLD/ppsrc/nemo/iom.f90(1986): error #6285: There is no matching specific subroutine for this generic subroutine call.   [XIOS_SEND_FIELD]
            CALL xios_send_field( cdname, pfield3d, ntile - 1 )
-----------------^
/data3/ueyoshi/nemo_4.2.0_git2/nemo_4.2.0/cfgs/ORCA2_ICE_PISCES/BLD/ppsrc/nemo/iom.f90(1998): error #6285: There is no matching specific subroutine for this generic subroutine call.   [XIOS_SEND_FIELD]
            CALL xios_send_field( cdname, pfield4d, ntile - 1 )
-----------------^
/data3/ueyoshi/nemo_4.2.0_git2/nemo_4.2.0/cfgs/ORCA2_ICE_PISCES/BLD/ppsrc/nemo/iom.f90(2010): error #6285: There is no matching specific subroutine for this generic subroutine call.   [XIOS_SEND_FIELD]
            CALL xios_send_field( cdname, pfield4d, ntile - 1 )
-----------------^
/data3/ueyoshi/nemo_4.2.0_git2/nemo_4.2.0/cfgs/ORCA2_ICE_PISCES/BLD/ppsrc/nemo/iom.f90(2042): error #6627: This is an actual argument keyword name, and not a dummy argument name.   [NTILES]
            &    ntiles=ntiles, tile_ibegin=tile_ibegin, tile_jbegin=tile_jbegin, tile_ni=tile_ni, tile_nj=tile_nj,        &
-----------------^
/data3/ueyoshi/nemo_4.2.0_git2/nemo_4.2.0/cfgs/ORCA2_ICE_PISCES/BLD/ppsrc/nemo/iom.f90(2042): error #6627: This is an actual argument keyword name, and not a dummy argument name.   [TILE_IBEGIN]
            &    ntiles=ntiles, tile_ibegin=tile_ibegin, tile_jbegin=tile_jbegin, tile_ni=tile_ni, tile_nj=tile_nj,        &
--------------------------------^

FAIL: nemo_4.2.0 with %FPPFLAGS -C -traditional for Bad # preprocessor line

Log
fcm_internal compile:F nemo /data3/ueyoshi/nemo_4.2.0_git2/nemo_4.2.0/cfgs/ORCA2_ICE_PISCES/BLD/ppsrc/nemo/crs.f90 crs.o
mpiifort -c -cpp -o crs.o -I/data3/ueyoshi/nemo_4.2.0_git2/nemo_4.2.0/cfgs/ORCA2_ICE_PISCES/BLD/inc -r8 -O3 -xHost -fp-model source -traceback -I/data1/ueyoshi/local/xios-2.5/inc -I/data1/ueyoshi/local/NDIR_netcdf-c-4.4.1.1/include -I/data1/ueyoshi/local/HDIR_hdf5-1.8.9/include -I/opt/intel/compilers_and_libraries_2016.1.150/linux/mpi/intel64/include -c /data3/ueyoshi/nemo_4.2.0_git2/nemo_4.2.0/cfgs/ORCA2_ICE_PISCES/BLD/ppsrc/nemo/crs.f90
/data3/ueyoshi/nemo_4.2.0_git2/nemo_4.2.0/cfgs/ORCA2_ICE_PISCES/BLD/ppsrc/nemo//usr/include/stdc-predef.h(40): warning #5117: 
Bad # preprocessor line # 4 "/data3/ueyoshi/nemo_4.2.0_git2/nemo_4.2.0/cfgs/ORCA2_ICE_PISCES/BLD/ppsrc/nemo/<command-line>" 2
-----------------------------------------------------------------------------------------------------^
touch /data3/ueyoshi/nemo_4.2.0_git2/nemo_4.2.0/cfgs/ORCA2_ICE_PISCES/BLD/flags/FFLAGS__nemo__dianam.flags
touch /data3/ueyoshi/nemo_4.2.0_git2/nemo_4.2.0/cfgs/ORCA2_ICE_PISCES/BLD/flags/FFLAGS__nemo__phycst.flags
fcm_internal compile:F nemo /data3/ueyoshi/nemo_4.2.0_git2/nemo_4.2.0/cfgs/ORCA2_ICE_PISCES/BLD/ppsrc/nemo/phycst.f90 phycst.o
mpiifort -c -cpp -o phycst.o -I/data3/ueyoshi/nemo_4.2.0_git2/nemo_4.2.0/cfgs/ORCA2_ICE_PISCES/BLD/inc -r8 -O3 -xHost -fp-model source -traceback -I/data1/ueyoshi/local/xios-2.5/inc -I/data1/ueyoshi/local/NDIR_netcdf-c-4.4.1.1/include -I/data1/ueyoshi/local/HDIR_hdf5-1.8.9/include -I/opt/intel/compilers_and_libraries_2016.1.150/linux/mpi/intel64/include -c /data3/ueyoshi/nemo_4.2.0_git2/nemo_4.2.0/cfgs/ORCA2_ICE_PISCES/BLD/ppsrc/nemo/phycst.f90
/data3/ueyoshi/nemo_4.2.0_git2/nemo_4.2.0/cfgs/ORCA2_ICE_PISCES/BLD/ppsrc/nemo//usr/include/stdc-predef.h(40): warning #5117: 
Bad # preprocessor line # 4 "/data3/ueyoshi/nemo_4.2.0_git2/nemo_4.2.0/cfgs/ORCA2_ICE_PISCES/BLD/ppsrc/nemo/<command-line>" 2
-----------------------------------------------------------------------------------------------------^

FAIL: nemo_4.2.0 with %FPPFLAGS -P -C for undefined precision kind (space inserted _ sp)

Log
fcm_internal compile:F nemo /data3/ueyoshi/nemo_4.2.0_git2/nemo_4.2.0/cfgs/ORCA2_ICE_PISCES/BLD/ppsrc/nemo/lbcnfd.f90 lbcnfd.o
mpiifort -c -cpp -o lbcnfd.o -I/data3/ueyoshi/nemo_4.2.0_git2/nemo_4.2.0/cfgs/ORCA2_ICE_PISCES/BLD/inc -r8 -O3 -xHost -fp-model source -traceback -I/data1/ueyoshi/local/xios-2.5/inc -I/data1/ueyoshi/local/NDIR_netcdf-c-4.4.1.1/include -I/data1/ueyoshi/local/HDIR_hdf5-1.8.9/include -I/opt/intel/compilers_and_libraries_2016.1.150/linux/mpi/intel64/include -c /data3/ueyoshi/nemo_4.2.0_git2/nemo_4.2.0/cfgs/ORCA2_ICE_PISCES/BLD/ppsrc/nemo/lbcnfd.f90
/data3/ueyoshi/nemo_4.2.0_git2/nemo_4.2.0/cfgs/ORCA2_ICE_PISCES/BLD/ppsrc/nemo/lbcnfd.f90(81): error #5082: Syntax error, found ',' when expecting one of: =
   SUBROUTINE lbc_nfd_ sp( ptab, cd_nat, psgn, khls, kfld )
---------------------------------------^
/data3/ueyoshi/nemo_4.2.0_git2/nemo_4.2.0/cfgs/ORCA2_ICE_PISCES/BLD/ppsrc/nemo/lbcnfd.f90(82): error #5082: Syntax error, found IDENTIFIER 'SP' when expecting one of: ( )
      TYPE(PTR_4d_ sp), DIMENSION(:), INTENT(inout) :: ptab ! pointer of arrays on which apply the b.c.
-------------------^
/data3/ueyoshi/nemo_4.2.0_git2/nemo_4.2.0/cfgs/ORCA2_ICE_PISCES/BLD/ppsrc/nemo/lbcnfd.f90(469): error #5082: Syntax error, found IDENTIFIER 'SP' when expecting one of: <END-OF-STATEMENT> ; <END-OF-FILE>
   END SUBROUTINE lbc_nfd_ sp
---------------------------^
/data3/ueyoshi/nemo_4.2.0_git2/nemo_4.2.0/cfgs/ORCA2_ICE_PISCES/BLD/ppsrc/nemo/lbcnfd.f90(82): error #6818: The statement following a CONTAINS is not a function-stmt or a subroutine-stmt.
      TYPE(PTR_4d_ sp), DIMENSION(:), INTENT(inout) :: ptab ! pointer of arrays on which apply the b.c.
-----------^
/data3/ueyoshi/nemo_4.2.0_git2/nemo_4.2.0/cfgs/ORCA2_ICE_PISCES/BLD/ppsrc/nemo/lbcnfd.f90(82): error #6236: A specification statement cannot appear in the executable section.
      TYPE(PTR_4d_ sp), DIMENSION(:), INTENT(inout) :: ptab ! pointer of arrays on which apply the b.c.
------^

FAIL: nemo_4.2.0 with %FPPFLAGS -P -C -N -traditional for undefined precision kind (space inserted _ sp)

Log
mpiifort -c -cpp -o lbcnfd.o -I/data3/ueyoshi/nemo_4.2.0_git2/nemo_4.2.0/cfgs/ORCA2_ICE_PISCES/BLD/inc -r8 -O3 -xHost -fp-model source -traceback -I/data1/ueyoshi/local/xios-2.5/inc -I/data1/ueyoshi/local/NDIR_netcdf-c-4.4.1.1/include -I/data1/ueyoshi/local/HDIR_hdf5-1.8.9/include -I/opt/intel/compilers_and_libraries_2016.1.150/linux/mpi/intel64/include -c /data3/ueyoshi/nemo_4.2.0_git2/nemo_4.2.0/cfgs/ORCA2_ICE_PISCES/BLD/ppsrc/nemo/lbcnfd.f90
/data3/ueyoshi/nemo_4.2.0_git2/nemo_4.2.0/cfgs/ORCA2_ICE_PISCES/BLD/ppsrc/nemo/lbcnfd.f90(96): error #5082: Syntax error, found ',' when expecting one of: =
   SUBROUTINE lbc_nfd_ sp( ptab, cd_nat, psgn, khls, kfld )
---------------------------------------^
/data3/ueyoshi/nemo_4.2.0_git2/nemo_4.2.0/cfgs/ORCA2_ICE_PISCES/BLD/ppsrc/nemo/lbcnfd.f90(97): error #5082: Syntax error, found IDENTIFIER 'SP' when expecting one of: ( )
      TYPE(PTR_4d_ sp),  DIMENSION(:), INTENT(inout) ::   ptab        ! pointer of arrays on which apply the b.c.
-------------------^
/data3/ueyoshi/nemo_4.2.0_git2/nemo_4.2.0/cfgs/ORCA2_ICE_PISCES/BLD/ppsrc/nemo/lbcnfd.f90(484): error #5082: Syntax error, found IDENTIFIER 'SP' when expecting one of: <END-OF-STATEMENT> ; <END-OF-FILE>
   END SUBROUTINE lbc_nfd_ sp
---------------------------^
/data3/ueyoshi/nemo_4.2.0_git2/nemo_4.2.0/cfgs/ORCA2_ICE_PISCES/BLD/ppsrc/nemo/lbcnfd.f90(97): error #6818: The statement following a CONTAINS is not a function-stmt or a subroutine-stmt.
      TYPE(PTR_4d_ sp),  DIMENSION(:), INTENT(inout) ::   ptab        ! pointer of arrays on which apply the b.c.
-----------^
/data3/ueyoshi/nemo_4.2.0_git2/nemo_4.2.0/cfgs/ORCA2_ICE_PISCES/BLD/ppsrc/nemo/lbcnfd.f90(97): error #6236: A specification statement cannot appear in the executable section.
      TYPE(PTR_4d_ sp),  DIMENSION(:), INTENT(inout) ::   ptab        ! pointer of arrays on which apply the b.c.
------^
/data3/ueyoshi/nemo_4.2.0_git2/nemo_4.2.0/cfgs/ORCA2_ICE_PISCES/BLD/ppsrc/nemo/lbcnfd.f90(98): error #6236: A specification statement cannot appear in the executable section.
      CHARACTER(len=1), DIMENSION(:), INTENT(in   ) ::   cd_nat      ! nature of array grid-points
------^

FINDLOC function is a Fortran 2008 intrinsic that is not supported by old compilers. You can comment out these lines if you don’t use the namelist logical ln_rst_list. You can also use the old version of restart.F90:

         IF( ln_rst_list ) THEN
            nrst_lst = 1
            nitrst = nn_stocklist( nrst_lst )
         ELSE
            nitrst = nitend
         ENDIF

A post was merged into an existing topic: Fortran preprocessing converts _/**/PRECISION to problematic _ sp

As the initial message mention two issues which are already addressed on other topics (see links after): I’m going to rewrite previous messages to focus on FINDLOC function subject.

If you are about to commit a bugfix, I just want to let you know that FINDLOC is also used for TOP restarts in src/TOP/trcrst.F90.

Committed by @smasson to r4.0-HEAD SVN branch, see Changeset 15810 – NEMO