Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28613 Discussions

Error: The procedure pointer and the procedure target must have matching arguments

tz0616
Beginner
1,143 Views

Hi all,

In the supercomputer, I get the following compilation error for "atmos_model.F90" (attached)

based on newer intel-classic-2023.1.0 compiler. It has no problem before by using older compiler.

 

atmos_model.F90(349): error #8178: The procedure pointer and the procedure target must have matching arguments.

     Func0d => radiation_step1

------^

atmos_model.F90(374): error #8178: The procedure pointer and the procedure target must have matching arguments.

     Func0d => physics_step1

------^

atmos_model.F90(399): error #8178: The procedure pointer and the procedure target must have matching arguments.

     Func0d => physics_step2

------^

 

I do some research online, it seems to be intel compiler issue. see links below.

 

https://community.intel.com/t5/Intel-Fortran-Compiler/Problem-with-procedure-pointers-matching-arguments/td-p/836404

 

https://community.intel.com/t5/Intel-Fortran-Compiler/error-8178-The-procedure-pointer-and-the-procedure-target-must/td-p/1062590

 

 But I do not understand how to fix it?

 

 Could you give me some ideals of how to fix my attached code?

 

 Thanks,

 Tao

 

 

Compilation error:

 

----------------------------

Build standalone FV3 stochastic_physics ...

 

make[2]: Nothing to be done for 'all'.

make[2]: Leaving directory '/gpfs/f5/cpcattr/scratch/Tao.Zhang/FV3V15/fv3gfs.fd_final_TZforC5/stochastic_physics'

make libfv3cap.a       FMS_DIR=/gpfs/f5/cpcattr/scratch/Tao.Zhang/FV3V15/fv3gfs.fd_final_TZforC5/FMS/FMS_INSTALL

make[2]: Entering directory '/gpfs/f5/cpcattr/scratch/Tao.Zhang/FV3V15/fv3gfs.fd_final_TZforC5/FV3'

ftn -Duse_libMPI -Duse_netCDF -DSPMD -DUSE_LOG_DIAG_FIELD_INFO -Duse_LARGEFILE -DUSE_GFSL63 -DGFS_PHYS -Duse_WRTCOMP -DNEW_TAUCTMAX -DINTERNAL_FILE_NML -DMOIST_CAPPA -DUSE_COND -DESMF_VERSION_MAJOR=8 -fpp -Wp,-w -I/gpfs/f5/cpcattr/scratch/Tao.Zhang/util/hpc-stack/c5/intel-classic-2023.1.0P5/intel-classic-2023.1.0/netcdf/4.7.4//include -I/gpfs/f5/cpcattr/scratch/Tao.Zhang/util/hpc-stack/c5/intel-classic-2023.1.0P5/intel-classic-2023.1.0/netcdf/4.7.4//include -fno-alias -auto -safe-cray-ptr -ftz -assume byterecl -nowarn -sox -align array64byte -i4 -real-size 64 -no-prec-div -no-prec-sqrt -xCORE-AVX2 -qno-opt-dynamic-align -O2 -debug minimal -fp-model source -qoverride-limits -g -traceback -qopenmp -I/gpfs/f5/cpcattr/scratch/Tao.Zhang/FV3V15/fv3gfs.fd_final_TZforC5/FMS/FMS_INSTALL -Igfsphysics -Iipd -Icpl -Iio -Iatmos_cubed_sphere -Iccpp/driver -I../stochastic_physics         -I/gpfs/f5/cfsrl/scratch/JieShun.Zhu/util/hpc-stack/c5/intel-classic-2023.1.0P5/intel-classic-2023.1.0/cray-mpich-8.1.25/esmf/8.1.0bs27/mod -I/gpfs/f5/cfsrl/scratch/JieShun.Zhu/util/hpc-stack/c5/intel-classic-2023.1.0P5/intel-classic-2023.1.0/cray-mpich-8.1.25/esmf/8.1.0bs27/include -I/gpfs/f5/cfsrl/scratch/JieShun.Zhu/util/hpc-stack/c5/intel-classic-2023.1.0P5/intel-classic-2023.1.0/cray-mpich-8.1.25/netcdf/4.7.4/include -c atmos_model.F90

ifort: command line warning #10121: overriding '-march=core-avx2' with '-xCORE-AVX2'

atmos_model.F90(349): error #8178: The procedure pointer and the procedure target must have matching arguments.

     Func0d => radiation_step1

------^

atmos_model.F90(374): error #8178: The procedure pointer and the procedure target must have matching arguments.

     Func0d => physics_step1

------^

atmos_model.F90(399): error #8178: The procedure pointer and the procedure target must have matching arguments.

     Func0d => physics_step2

------^

compilation aborted for atmos_model.F90 (code 1)

make[2]: *** [makefile:70: atmos_model.o] Error 1

make[2]: Leaving directory '/gpfs/f5/cpcattr/scratch/Tao.Zhang/FV3V15/fv3gfs.fd_final_TZforC5/FV3'

make[1]: *** [makefile:37: nems] Error 2

make[1]: Leaving directory '/gpfs/f5/cpcattr/scratch/Tao.Zhang/FV3V15/fv3gfs.fd_final_TZforC5/FV3'

make: *** [/gpfs/f5/cpcattr/scratch/Tao.Zhang/FV3V15/fv3gfs.fd_final_TZforC5/NEMS/src/incmake/component_FV3.mk:39:/gpfs/f5/cpcattr/scratch/Tao.Zhang/FV3V15/fv3gfs.fd_final_TZforC5/FV3/FV3_INSTALL/fv3.mk] Error 2

0 Kudos
1 Solution
FortranFan
Honored Contributor III
1,058 Views

@tz0616 ,

You may want to look into a book on Fortran (say by Chapman) and a reference book such as Modern Fortran Explained to understand procedure interfaces and pointer references followed by the code in this atmospheric model, especially the module "module_radiation_driver" and module "IPD_typedefs".

You can study the silly, small example below to further understand "The procedure pointer and the procedure target must have matching arguments" error.

   abstract interface
      subroutine Isub( a )
         integer, intent(in) :: a
      end subroutine
   end interface
   procedure(Isub), pointer :: ps
   ps => sub
contains
   subroutine sub( a )
      integer, intent(inout) :: a
   end subroutine
end 
C:\temp>ifx /c /free /standard-semantics p.f
Intel(R) Fortran Compiler for applications running on Intel(R) 64, Version 2023.2.0 Build 20230627
Copyright (C) 1985-2023 Intel Corporation. All rights reserved.

p.f(7): error #8178: The procedure pointer and the procedure target must have matching arguments.
   ps => sub
---^
compilation aborted for p.f (code 1)

C:\temp>

 

View solution in original post

5 Replies
Arjen_Markus
Honored Contributor I
1,125 Views

You do not show the definition of the routines radiation_step1, physics_step1 and physics_step2, but apparently the compiler has found a a discrepancy with the procedure interface that is connected to the pointer, IPD_func0d_proc. You should check what the discrepancy is and correct this difference. If there is no difference, then it may hint at a bug in the compiler.

I have not read the conversations you mention, but it is not uncommon for newer versions of a compiler to check more things, so that it looks as if the compiler is in error, whereas the code was incorrect in the first place. I do not know if that is the case here, but the first step is to check the interfaces in your code.

0 Kudos
tz0616
Beginner
1,083 Views

Hi Arjen,

 Thanks for your valuable comments.  I have compared my code with the new version code "atmos_model.JS.F90" (attached) that other people is using (other people do not have this issue), and the difference is summarized in "diff.atmos_model.ZT.and.JS.txt" (attached).

  I do not see the obvious differences contributing to the errors of "Func0d " in atmos_model.F90

 Then I think that the errors may come from other codes. I have attached the whole folder of FV3GFS model (fv3gfsv15.tar) and listed below the related 6 codes.

  In the last 3 driver codes, I find that the author had made comments which are related to the errors that I am reporting.

  I do not fully understand the issue, but maybe I just need to use the options same to gfortran in the last 3 driver codes.

 

  I am not sure if it is true?

 Thanks

 Tao

 

   FV3/atmos_model.F90

   FV3/ipd/IPD_typedefs.F90

   FV3/gfsphysics/GFS_layer/GFS_abstraction_layer.F90

 

 FV3/gfsphysics/GFS_layer/GFS_driver.F90

 FV3/gfsphysics/GFS_layer/GFS_physics_driver.F90

FV3/gfsphysics/GFS_layer/GFS_radiation_driver.F90

 

GFS_driver.F90:! interface routine (IPD_func0d_proc in IPD_typedefs.F90):
GFS_driver.F90:! Since IPD_func0d_proc declares all arguments as intent(inout), we
GFS_physics_driver.F90:! interface routine (IPD_func0d_proc in IPD_typedefs.F90):
GFS_physics_driver.F90:! Since IPD_func0d_proc declares all arguments as intent(inout), we
GFS_radiation_driver.F90:! interface routine (IPD_func0d_proc in IPD_typedefs.F90):
GFS_radiation_driver.F90:! Since IPD_func0d_proc declares all arguments as intent(inout), we

Author's comments in three driver codes:

---------------------------------

! DH* gfortran correctly throws an error if the intent() declarations
! for arguments differ between the actual routine (here) and the dummy
! interface routine (IPD_func0d_proc in IPD_typedefs.F90):
!
! Error: Interface mismatch in procedure pointer assignment at (1): INTENT mismatch in argument 'control'
!
! Since IPD_func0d_proc declares all arguments as intent(inout), we
! need to do the same here - however, this way we are loosing the
! valuable information on the actual intent to this routine. *DH
#ifdef __GFORTRAN__
type(GFS_control_type), intent(inout) :: Model
type(GFS_statein_type), intent(inout) :: Statein
type(GFS_stateout_type), intent(inout) :: Stateout
type(GFS_sfcprop_type), intent(inout) :: Sfcprop
type(GFS_coupling_type), intent(inout) :: Coupling
type(GFS_grid_type), intent(inout) :: Grid
type(GFS_tbd_type), intent(inout) :: Tbd
type(GFS_cldprop_type), intent(inout) :: Cldprop
type(GFS_radtend_type), intent(inout) :: Radtend
type(GFS_diag_type), intent(inout) :: Diag
#else
type(GFS_control_type), intent(in) :: Model
type(GFS_statein_type), intent(in) :: Statein
type(GFS_stateout_type), intent(inout) :: Stateout
type(GFS_sfcprop_type), intent(in) :: Sfcprop
type(GFS_coupling_type), intent(inout) :: Coupling
type(GFS_grid_type), intent(in) :: Grid
type(GFS_tbd_type), intent(in) :: Tbd
type(GFS_cldprop_type), intent(in) :: Cldprop
type(GFS_radtend_type), intent(inout) :: Radtend
type(GFS_diag_type), intent(inout) :: Diag
#endif

 

0 Kudos
FortranFan
Honored Contributor III
1,059 Views

@tz0616 ,

You may want to look into a book on Fortran (say by Chapman) and a reference book such as Modern Fortran Explained to understand procedure interfaces and pointer references followed by the code in this atmospheric model, especially the module "module_radiation_driver" and module "IPD_typedefs".

You can study the silly, small example below to further understand "The procedure pointer and the procedure target must have matching arguments" error.

   abstract interface
      subroutine Isub( a )
         integer, intent(in) :: a
      end subroutine
   end interface
   procedure(Isub), pointer :: ps
   ps => sub
contains
   subroutine sub( a )
      integer, intent(inout) :: a
   end subroutine
end 
C:\temp>ifx /c /free /standard-semantics p.f
Intel(R) Fortran Compiler for applications running on Intel(R) 64, Version 2023.2.0 Build 20230627
Copyright (C) 1985-2023 Intel Corporation. All rights reserved.

p.f(7): error #8178: The procedure pointer and the procedure target must have matching arguments.
   ps => sub
---^
compilation aborted for p.f (code 1)

C:\temp>

 

tz0616
Beginner
1,048 Views
@

 

Your simple example is very helpful. The error code (error #8178) is same as mine.  Two subroutines have Intent (in) and intent (inout), respectively, which may cause the mismatch issue.

 

I  post below key sentences in "IPD_typedefs.F90", it seems that IPD_func0d_proc has "intent(inout)" for all the variables.

But three driver codes use both " intent(inout) and intent(in)" for different variables, which may work for old intel compiler but not  for

 new intel compiler. So I think three driver codes have to use " intent(inout) for all variables, in order to make a successful compilation.

 Thanks for recommending the book on Fortran (say by Chapman) and a reference book such as Modern Fortran Explained to understand procedure interfaces and pointer references.

 

!------------------------------------------------------
! IPD function procedures
! definitions for scalar(0d) and vector(1d) versions
!------------------------------------------------------
abstract interface
subroutine IPD_func0d_proc (Control, Statein, Stateout, &
Sfcprop, Coupling, Grid, &
Tbd, Cldprop, Radtend, &
Intdiag)
import :: IPD_control_type, statein_type, stateout_type, &
sfcprop_type, coupling_type, grid_type, tbd_type, &
cldprop_type, radtend_type, intdiag_type
type(IPD_control_type), intent(inout) :: Control
type(statein_type), intent(inout) :: Statein
type(stateout_type), intent(inout) :: Stateout
type(sfcprop_type), intent(inout) :: Sfcprop
type(coupling_type), intent(inout) :: Coupling
type(grid_type), intent(inout) :: Grid
type(tbd_type), intent(inout) :: Tbd
type(cldprop_type), intent(inout) :: Cldprop
type(radtend_type), intent(inout) :: Radtend
type(intdiag_type), intent(inout) :: Intdiag
end subroutine IPD_func0d_proc

 

0 Kudos
tz0616
Beginner
994 Views

All,

 Thanks for your great comments. It turns out that it is not the issue of "atmos_model.F90".

 The issue is caused by three driver codes which have different intent() arguments from IPD_func0d_proc subroutine.

 After I change three codes, the compilation is successful now. see below.

 Thanks again,

 Tao

-------------------

ftn -o /gpfs/f5/cpcattr/scratch/Tao.Zhang/FV3V15/fv3gfs.fd_final_TZforC5/NEMS/exe/NEMS.x MAIN_NEMS.o module_NEMS_UTILS.o module_MEDIATOR_methods.o module_MEDIATOR.o module_MEDIATOR_SpaceWeather.o module_EARTH_INTERNAL_STATE.o module_EARTH_GRID_COMP.o module_NEMS_INTERNAL_STATE.o module_NEMS_GRID_COMP.o module_NEMS_Rusage.o nems_c_rusage.o /gpfs/f5/cpcattr/scratch/Tao.Zhang/FV3V15/fv3gfs.fd_final_TZforC5/FV3/FV3_INSTALL/libfv3cap.a /gpfs/f5/cpcattr/scratch/Tao.Zhang/FV3V15/fv3gfs.fd_final_TZforC5/FV3/FV3_INSTALL/libfv3core.a /gpfs/f5/cpcattr/scratch/Tao.Zhang/FV3V15/fv3gfs.fd_final_TZforC5/FV3/FV3_INSTALL/libfv3io.a /gpfs/f5/cpcattr/scratch/Tao.Zhang/FV3V15/fv3gfs.fd_final_TZforC5/FV3/FV3_INSTALL/libipd.a /gpfs/f5/cpcattr/scratch/Tao.Zhang/FV3V15/fv3gfs.fd_final_TZforC5/FV3/FV3_INSTALL/libgfsphys.a /gpfs/f5/cpcattr/scratch/Tao.Zhang/FV3V15/fv3gfs.fd_final_TZforC5/FV3/FV3_INSTALL/libfv3cpl.a /gpfs/f5/cpcattr/scratch/Tao.Zhang/FV3V15/fv3gfs.fd_final_TZforC5/FV3/FV3_INSTALL/libstochastic_physics.a /gpfs/f5/cpcattr/scratch/Tao.Zhang/FV3V15/fv3gfs.fd_final_TZforC5/FMS/FMS_INSTALL/libfms.a ENS_Cpl/ENS_Cpl.a /gpfs/f5/cpcattr/scratch/Tao.Zhang/util/hpc-stack/c5/intel-classic-2023.1.0P5/intel-classic-2023.1.0/cray-mpich-8.1.25/upp/10.0.10/lib/libupp.a /gpfs/f5/cpcattr/scratch/Tao.Zhang/util/hpc-stack/c5/intel-classic-2023.1.0P5/intel-classic-2023.1.0/cray-mpich-8.1.25/nemsio/2.5.4/lib64/libnemsio.a /gpfs/f5/cpcattr/scratch/Tao.Zhang/util/hpc-stack/c5/intel-classic-2023.1.0P5/intel-classic-2023.1.0/g2/3.4.5/lib64/libg2_4.a /gpfs/f5/cpcattr/scratch/Tao.Zhang/util/hpc-stack/c5/intel-classic-2023.1.0P5/intel-classic-2023.1.0/g2tmpl/1.10.2/lib/libg2tmpl.a /gpfs/f5/cpcattr/scratch/Tao.Zhang/util/hpc-stack/c5/intel-classic-2023.1.0P5/intel-classic-2023.1.0/bacio/2.4.1/lib/libbacio_4.a /gpfs/f5/cpcattr/scratch/Tao.Zhang/util/hpc-stack/c5/intel-classic-2023.1.0P5/intel-classic-2023.1.0/sp/2.3.3/lib/libsp_d.a /gpfs/f5/cpcattr/scratch/Tao.Zhang/util/hpc-stack/c5/intel-classic-2023.1.0P5/intel-classic-2023.1.0/w3emc/2.9.2/lib64/libw3emc_d.a /gpfs/f5/cpcattr/scratch/Tao.Zhang/util/hpc-stack/c5/intel-classic-2023.1.0P5/intel-classic-2023.1.0/w3nco/2.4.1/lib/libw3nco_d.a /gpfs/f5/cpcattr/scratch/Tao.Zhang/util/hpc-stack/c5/intel-classic-2023.1.0P5/intel-classic-2023.1.0/cray-mpich-8.1.25/crtm/2.4.0/lib/libcrtm.a /gpfs/f5/cpcattr/scratch/Tao.Zhang/util/hpc-stack/c5/intel-classic-2023.1.0P5/intel-classic-2023.1.0/libpng/1.6.37/lib64/libpng.a /gpfs/f5/cpcattr/scratch/Tao.Zhang/util/hpc-stack/c5/intel-classic-2023.1.0P5/intel-classic-2023.1.0/jasper/2.0.25/lib64/libjasper.a /gpfs/f5/cpcattr/scratch/Tao.Zhang/util/hpc-stack/c5/intel-classic-2023.1.0P5/intel-classic-2023.1.0/zlib/1.2.11/lib/libz.a -L/gpfs/f5/cfsrl/scratch/JieShun.Zhu/util/hpc-stack/c5/intel-classic-2023.1.0P5/intel-classic-2023.1.0/cray-mpich-8.1.25/esmf/8.1.0bs27/lib -lesmf -cxxlib -lrt -ldl -lnetcdff -lnetcdf -lhdf5_hl -lhdf5 -lz -ldl -lm -qopenmp -L/opt/intel/oneapi/compiler/2023.1.0///lib/intel64 -lifcoremt -L /gpfs/f5/cpcattr/scratch/Tao.Zhang/util/hpc-stack/c5/intel-classic-2023.1.0P5/intel-classic-2023.1.0/cray-mpich-8.1.25/hdf5/1.10.6/lib -lhdf5 -lhdf5_hl -lhdf5 -lz -L /gpfs/f5/cpcattr/scratch/Tao.Zhang/util/hpc-stack/c5/intel-classic-2023.1.0P5/intel-classic-2023.1.0/netcdf/4.7.4/lib -lnetcdff -lnetcdf
/gpfs/f5/cpcattr/scratch/Tao.Zhang/FV3V15/fv3gfs.fd_final_TZforC5/NEMS/exe/NEMS.x is created.
make[1]: Leaving directory '/gpfs/f5/cpcattr/scratch/Tao.Zhang/FV3V15/fv3gfs.fd_final_TZforC5/NEMS/src'

0 Kudos
Reply