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

Compile issue: The number of actual arguments cannot be greater than the number of dummy arguments

H__Donald
Beginner
1,347 Views

OS: Windows 10 Enterprise 64 Bit

Intel Compiler: Intel(R) Visual Fortran Compiler 19.1.0.166 [IA-32]...

Summary of issue: Full rebuild produces no error.  However recompiling for any reason produces a "The number of actual arguments cannot be greater than the number of dummy arguments"

I needed to port existing FORTRAN 66 code and add functionality without altering current function signatures because of backward compatibility issues.

The original function is CALCULATE.  

I copied the code to CALCULATE2 (and renamed the function to CALCULATE2)

I then modified CALCULATE to call CALCULATE2.  (Same parameter list as shown below)  A lot of the variables are IMPLICITELY DEFINED.

I also created CALCULATEMEM which also calls CALCULATE.  The function signature is different so the data can be passed back via memory instead of disk.

A full rebuild compiles okay.  However subsequent rebuilds produce the following:

I even tried explicitly declaring each variable for each subroutine, and I still get the same errors.
 

1>[path]\CALCULATEMEM.for(16): error #6784: The number of actual arguments cannot be greater than the number of dummy arguments.   [HXCALC2]
1>[path]\CALCULATEMEM.for(17): error #6633: The type of the actual argument differs from the type of the dummy argument.   [NHG]
1>[path]\CALCULATEMEM.for(18): error #6633: The type of the actual argument differs from the type of the dummy argument.   [PCTD]
1>[path]\CALCULATEMEM.for(18): error #6633: The type of the actual argument differs from the type of the dummy argument.   [CTYPE]
1>[path]\CALCULATEMEM.for(19): error #6633: The type of the actual argument differs from the type of the dummy argument.   [PCODE]
1>[path]\CALCULATEMEM.for(19): error #7938: Character length argument mismatch.   [DBUG]

      SUBROUTINE CALCULATEMEM(IALT,ITPC,IROW,ICOAT,ICN,IVU,NFLD,NHZ,IDIS,NVER,
     <NREV,IPH1,MINFPI,MAXFPI,NHG,EVL,EDB,EWB,TLIQ,WFLO,FCON,FTK,FINW,
     <FINH,TWALL,XSHT,XDMU,TLL,QTT,TLA,RPH1,PSTM,FOUL,PCTD,RATSEL,CTYPE,
     <FINM,PCODE,ZPLIT,CASE,MTLHD,MTLCN,DBUG, REPT, USRWRN)

      !DEC$ ATTRIBUTES DLLEXPORT,STDCALL,REFERENCE :: CALCULATEMEM
      !DEC$ ATTRIBUTES MIXED_STR_LEN_ARG :: CALCULATEMEM
      !DEC$ ATTRIBUTES ALIAS:'CALCULATEMEM',DECORATE :: CALCUALTEMEM
      
      CHARACTER RATSEL*6,FINM*8,ZPLIT*5,GPATH*80,PATH*80    
      CHARACTER CASE*2,CMAT*8,DBUG*1,KEYECS*6,DPATH*80,MTLHD*2,MTLCN*2      
      CHARACTER REPT*16192, USRWRN*4096
      
      WT2MEM = 1
      
      CALL CALCUALTE2(IALT,ITPC,IROW,ICOAT,ICN,IVU,NFLD,NHZ,IDIS,NVER,
     <NREV,IPH1,MINFPI,MAXFPI,NHG,EVL,EDB,EWB,TLIQ,WFLO,FCON,FTK,FINW,
     <FINH,TWALL,XSHT,XDMU,TLL,QTT,TLA,RPH1,PSTM,FOUL,PCTD,RATSEL,CTYPE,
     <FINM,PCODE,ZPLIT,CASE,MTLHD,MTLCN,DBUG,GPATH,DPATH)
      
      RETURN
      END
      SUBROUTINE CALCULATE(IALT,ITPC,IROW,ICOAT,ICN,IVU,NFLD,NHZ,IDIS,NVER,
     <NREV,IPH1,MINFPI,MAXFPI,NHG,EVL,EDB,EWB,TLIQ,WFLO,FCON,FTK,FINW,
     <FINH,TWALL,XSHT,XDMU,TLL,QTT,TLA,RPH1,PSTM,FOUL,PCTD,RATSEL,CTYPE,
     <FINM,PCODE,ZPLIT,CASE,MTLHD,MTLCN,DBUG,GPATH,DPATH)

      !DEC$ ATTRIBUTES DLLEXPORT,STDCALL,REFERENCE :: CALCULATE
      !DEC$ ATTRIBUTES MIXED_STR_LEN_ARG :: CALCULATE
      !DEC$ ATTRIBUTES ALIAS:'CALCULATE',DECORATE :: CALCULATE      

      INCLUDE '..\COMMON\WRTMEM.CMN'
      CHARACTER RATSEL*6,FINM*8,ZPLIT*5,GPATH*80,PATH*80    
      CHARACTER  CASE*2,CMAT*8,DBUG*1,KEYECS*6,DPATH*80,MTLHD*2,MTLCN*2
      
         
      WT2MEM = 0
      
      CALL CALCULATE2(IALT,ITPC,IROW,ICOAT,ICN,IVU,NFLD,NHZ,IDIS,NVER,
     <NREV,IPH1,MINFPI,MAXFPI,NHG,EVL,EDB,EWB,TLIQ,WFLO,FCON,FTK,FINW,
     <FINH,TWALL,XSHT,XDMU,TLL,QTT,TLA,RPH1,PSTM,FOUL,PCTD,RATSEL,CTYPE,
     <FINM,PCODE,ZPLIT,CASE,MTLHD,MTLCN,DBUG,GPATH,DPATH)     

      RETURN
      END


 

      SUBROUTINE CALCULATE2(IALT,ITPC,IROW,ICOAT,ICN,IVU,NFLD,NHZ,IDIS,NVER,
     <NREV,IPH1,MINFPI,MAXFPI,NHG,EVL,EDB,EWB,TLIQ,WFLO,FCON,FTK,FINW,
     <FINH,TWALL,XSHT,XDMU,TLL,QTT,TLA,RPH1,PSTM,FOUL,PCTD,RATSEL,CTYPE,
     <FINM,PCODE,ZPLIT,CASE,MTLHD,MTLCN,DBUG,GPATH,DPATH)

      !DEC$ ATTRIBUTES MIXED_STR_LEN_ARG :: CALCULATE2

      INCLUDE '..\COMMON\WRTMEM.CMN'
      CHARACTER RATSEL*6,CTYPE*3,FINM*8,PCODE*3,ZPLIT*5,GPATH*80,PATH*80    
      CHARACTER CASE*2,CMAT*8,DBUG*1,KEYECS*6,DPATH*80,MTLHD*2,MTLCN*2
      RETURN
      END

 

 

0 Kudos
4 Replies
Hess__Donald
Beginner
1,347 Views

I figured it out this morning.

When I renamed the functions, a comma was pushed over to column 71, hence not being part of the compile.

Thanks

-Don

0 Kudos
Steve_Lionel
Honored Contributor III
1,347 Views

Two observations.

1. The source as you have posted it here is not compilable. If I assume those < characters are meant to be in column 6, then some of the source lines extend past column 72, likely the immediate cause of the errors. Even the original CALCULATE routine goes past column 72.

2. The reason you got errors on the rebuild is that the compiler's generated interface checking is sensitive to build order. In order to do its checks, the called procedure has to be compiled before the call.

Try compiling with /extend_source and see if that makes the errors go away. Ideally you would rewrap the long lines so as to not go past column 72.

0 Kudos
John_Campbell
New Contributor II
1,347 Views

The inconsistent argument count is probably related to column 73, assuming fixed format code, as "<" is not a free-format continuation syntax.

There appears to be incompatibility between the arguments for the 3 declarations as CHARACTER CTYPE*3,PCODE*3 are not defined in the first 2 file examples, but are in the 3rd. This may be the cause of your problem. This produces inconsistent arguments for CALL CALCUALTE2 ( or CALCULATE2 spelling error ? or surprising successful linking) Mixing default REAL and CHARACTER arguments usually does not work.

INCLUDE '..\COMMON\WRTMEM.CMN' was not provided but does not appear to offer any required information, although :

for SUBROUTINE CALCULATEMEM , WT2MEM is a local variable with no apparent reference.

for SUBROUTINE CALCULATE, WT2MEM is again a local variable or might be referenced in the include file.

for all : CHARACTER CMAT*8,KEYECS*6,PATH*80 do not appear to be used.

My interpretation of the first file is :

      SUBROUTINE CALCULATEMEM (IALT,ITPC,IROW,ICOAT,ICN,IVU,NFLD,NHZ,
     1 IDIS,NVER,NREV,IPH1,MINFPI,MAXFPI,NHG,EVL,EDB,EWB,TLIQ,WFLO,FCON,
     2 FTK,FINW,FINH,TWALL,XSHT,XDMU,TLL,QTT,TLA,RPH1,PSTM,FOUL,PCTD,
     3 RATSEL,CTYPE,FINM,PCODE,ZPLIT,CASE,MTLHD,MTLCN,DBUG, 
     4 REPT,USRWRN)

!DEC$ ATTRIBUTES DLLEXPORT,STDCALL,REFERENCE   :: CALCULATEMEM
!DEC$ ATTRIBUTES MIXED_STR_LEN_ARG             :: CALCULATEMEM
!DEC$ ATTRIBUTES ALIAS:'CALCULATEMEM',DECORATE :: CALCUALTEMEM
 
      CHARACTER RATSEL*6,FINM*8,ZPLIT*5,CASE*2,MTLHD*2,MTLCN*2,DBUG*1        ! no CTYPE*3,PCODE*3
      CHARACTER REPT*16192, USRWRN*4096
      CHARACTER GPATH*80, DPATH*80

      CHARACTER CMAT*8,KEYECS*6,PATH*80  
 
      WT2MEM = 1
 
      CALL CALCUALTE2 (IALT,ITPC,IROW,ICOAT,ICN,IVU,NFLD,NHZ,
     1 IDIS,NVER,NREV,IPH1,MINFPI,MAXFPI,NHG,EVL,EDB,EWB,TLIQ,WFLO,FCON,
     2 FTK,FINW,FINH,TWALL,XSHT,XDMU,TLL,QTT,TLA,RPH1,PSTM,FOUL,PCTD,
     3 RATSEL,CTYPE,FINM,PCODE,ZPLIT,CASE,MTLHD,MTLCN,DBUG, 
     4 GPATH,DPATH)
 
      RETURN
      END

 

0 Kudos
jimdempseyatthecove
Honored Contributor III
1,347 Views

For differing number of arguments, declare CALCULATE as a generic name for your two procedures. See:

https://software.intel.com/en-us/fortran-compiler-developer-guide-and-reference-defining-generic-names-for-procedures#80EED4AA-A408-429F-8C95-C40EE85D6690

Jim Dempsey

0 Kudos
Reply