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

question with my arguments and compilers

carlos8410
Beginner
625 Views
Hi,

I have come into a problem with the arguments and the compiler. When I call subroutine B in subroutine A and pass the arguments, there are always some errors like below. But if I copy the code and paste in a new project, everything is fine. I am using the IVF version 10, which is the trial version. And when I use the version 9 to compile the code, there is no error. I don't understand what's the problem. How can two compilers have different results and creating a new project can eliminate the errors?

Error: The type of the actual argument differs from the type of the dummy argument
Error: The shape matching rules of actual arguments and dummy arguments have been violated.
Error: If the actual argument is scalar, the corresponding dummy argument shall be scalar unless the actual argument is an element of an array that is not an assumed-shape or pointer array, or a substring of such an element.
0 Kudos
4 Replies
DavidWhite
Valued Contributor II
625 Views
Carlos,
If you can post the actual lines of code, I could tell you exactly what is wromg. However, it is clear that you have one or two errors here, something like:
Program Main
Real :: X
Call Sub (X)
...

Subroutine Sub(X)
Real :: X(2)
or even
Integer :: X(2)

The first error - difference is type is where the type in the calling program (i.e. real in my example) is different from in the subroutine (e.g. integer).
the second & third error messages are where the calling argument is a scalar (e.g. X in my main program) and the subroutine is expecting an array, e.g. X(2)

Hope this helps, if not post some code.

David
0 Kudos
Steven_L_Intel1
Employee
625 Views
The reason you do not see these errors in version 9 is that version 10 enables "generated interface checking" by default for new projects - this feature was new in version 9.1 but was not on by default. See David's reply for good advice.
0 Kudos
carlos8410
Beginner
625 Views
Hi, Steve and David

Thank you for your suggestion.
I check the previous post and I think I get your point.
So after I change the arguments, I delete all the mod in debug folder and compiler the code. And no error happens.
I guess there would be no error happen if I deleter all the old mod after I change the arguments and then compiler.

Below is my code, the original code is too large to post here, so I just copy the definition part and skip the other part. I
don't know if there is any error hidden in it.

************************************************************
SUBROUTINE SUB_A (N,NPT,X,RHOBEG, ... ,XPT,W)

IMPLICIT REAL*8 (A-H,O-Z)
DIMENSION X(*),XPT(NPT,*),W(*)
...
CALL ITERATION (N,NPT,RHOENDX, ... ,W,XPT)


SUBROUTINE ITERATION (N,NPT,RHOENDX, ... ,W,XPT)
IMPLICIT REAL*8 (A-H,O-Z)
DIMENSION X(*),W(*),XPT(NPT,*)
...


0 Kudos
Steven_L_Intel1
Employee
625 Views
Yes, there can be a problem if you compile your sources, edit them so that the arguments to a routine change, and then do a "build". In some cases, the generated module for the old version of your routines will not be updated and you can get these errors. A Rebuild will fix that or delete all the .mod files.
0 Kudos
Reply