Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
3 Views

Intel® Visual Fortran Compiler:error #6634

Hi,

I am not expert on programming and I am working on a code not written by me. I am using Intel® Visual Fortran Compiler 2013 and when I run the code this error occurs.

Error    2     error #6634: The shape matching rules of actual arguments and dummy arguments have been violated.   [FREQ]   

1.JPG

 

2.JPG

 

How could I fix the error?

Thank you in advance

 

 

 

0 Kudos
20 Replies
Highlighted
Valued Contributor III
3 Views

@Baioni, Elisa:

@Baioni, Elisa:

You write "I am not expert on programming" and the error you are facing is a very basic one.  Would you be interested in reviewing some good books on Fortran so you can resolve such basic problems by yourself?  See this:

https://software.intel.com/en-us/blogs/2013/12/30/doctor-fortran-in-its-a-modern-fortran-world

0 Kudos
Highlighted
Black Belt
3 Views

FortranFan's advice is good,

FortranFan's advice is good, and I endorse it, but I'll give you a bit of direction (since you omitted crucial details).

The Fortran language requires that when you call a procedure, each argument you pass ("actual argument" in Fortran-speak) must match the called procedure's corresponding receiving argument ("dummy argument") in Type, Rank and Kind (often referred to as TKR.) Type is the entity's declared type (INTEGER, REAL, TYPE(sometype), etc.). Rank is the number of dimensions, and Kind is the qualifier on type (such as INTEGER(4), etc.)

When a dummy argument is an array that isn't "assumed shape" (declared with (:) bounds), or "assumed size" (*), the corresponding actual argument must have the same shape. In Fortran terminology, shape is a combination of rank (number of dimensions) and extent (number of elements in each dimension.) Fortran does have an "escape hatch" from this requirement if you pass a single element of an array, leading to something called "sequence association", but that doesn't apply here.

The compiler is complaining that in (at least) one of the calls, the variable FREQ, which I see is declared as (10), doesn't match the shape of the corresponding dummy argument (which you have not shown.) Such a mismatch is not allowed in Fortran.

Now you may be wondering why this source compiled with some older or other compiler. It's probably (and I say this because you haven't shown us enough of the program to know) that the code is arranged as a set of external procedures without explicit interfaces. Normally this doesn't give a compiler information to compare the call with the called, but Intel Fortran has a feature called "generated interface checking" that is on by default in new Visual Studio projects. This allows the compiler to cross-check calls even though you're not using explicit interfaces, and the compiler can then detect coding errors you might not have seen before.

Now it's your turn - use the information the compiler gave you (including the line of the call in question, which you also omitted) to cross-check the calls and fix the error. 

Steve (aka "Doctor Fortran") - https://stevelionel.com/drfortran
0 Kudos
Highlighted
Beginner
3 Views

Than for your help, I fixed

Than for your help, I fixed the error. But now there is another error.

Error    1     error #6285: There is no matching specific subroutine for this generic subroutine call.   [LSARG]   

How can I fix it? I attach the file.

Thank you.

0 Kudos
Highlighted
Black Belt
3 Views

I don't have IMSL anymore,

I don't have IMSL anymore, but what I can see is that this code calls the generic name LSARG but passes the arguments as if the non-generic "FORTRAN 77" version was being used. Since you have declared the arrays to be fixed size, it's probably not going to work to use the so-called "Fortran 90" interface.

Try replacing USE LSARG_INT with USE NUMERICAL_LIBRARIES and see if that does the trick.

 

Steve (aka "Doctor Fortran") - https://stevelionel.com/drfortran
0 Kudos
Highlighted
Beginner
3 Views

Thank for you reply. As you

Thank for you reply. As you suggested, I replaced USE LSARG_INT with USE NUMERICAL_LIBRARIES, but these errors occur:

  • Error    1     error #6401: The attributes of this name conflict with those made accessible by a USE statement.   [FREQ]    line   8

  • Error    2     error #6553: A function reference is invoking a subroutine subprogram.   [FREQ]    line    62    

  • Error    3     error #7021: Name invalid in this context   [FREQ]    line    62 

Thank you.

0 Kudos
Highlighted
Beginner
3 Views

I tried to write USE

I tried to write USE NUMERICAL_LIBRARIES,XCEPT=>FREQ . In this way the previous errors disappear, but the error "Error    2     error #6634: The shape matching rules of actual arguments and dummy arguments have been violated.   [FREQ]" occurs at line 141. Should I enter the dimension of FREQ in the subroutine? Doing this, this error occurs:

Unhandled exception at 0x00007ff7bf96ffe7 in Progetto flusso.exe: 0xC00000FD: Stack overflow.   

What should I do?

Thank you

0 Kudos
Highlighted
Black Belt
3 Views

Since I don't have IMSL, I

Since I don't have IMSL, I can't help you further. Maybe one of the other forum members with IMSL access can help.

Steve (aka "Doctor Fortran") - https://stevelionel.com/drfortran
0 Kudos
Highlighted
Black Belt
3 Views

Elisa, I think that your

Elisa, I think that your difficulties are caused by the use of LSARG in IMSL with two different meaning. If you provide an explicit interface to LSARG in your Fortran source code, by having an INCLUDE or USE statement for the generic name LSARG, the compiler will expect the call to have the form

CALL LSARG (A, B, X [, …])

and this call will be resolved by a call to S_LSARG or D_LSARG, depending on the type of A, B and X.

If no explicit interface is provided,  the call to LSARG will be understood to be a Fortran-77 style call for the single-precision version of LSARG, with an implicit interface and argument list as in

CALL LSARG (N, A, LDA, B, IPATH, X)

If you provide an explicit Fortran-9X interface but the call uses the Fortran-77 argument list, the interface and the calling sequence are mismatched and an error message is issued at compile time.

As far as I can see from a quick scan, your source code issues a Fortran-77 style call to LSARG. Therefore, you should either remove any IMSL USE or INCLUDE statements in the program unit with the LSARG call or, if you have other calls to IMSL for which the USE or INCLUDE statements are needed, provide a USE statement with an EXCEPT=>LSARG clause.

I have not checked your code as to whether the arguments being passed to LSARG are correct. I assume that you have done that yourself already.

0 Kudos
Highlighted
Beginner
3 Views

Thank you for the reply. I

Thank you for the reply. I tried to remove USE NUMERICAL_LIBRARIES,XCEPT=>FREQ but the error remains. If I remove also INCLUDE 'link_fnl_shared_imsl.h' these errors occur:

  • fatal error LNK1120: 1 unresolved externals    x64\Debug\Progetto flusso.exe    
  • error LNK2019: unresolved external symbol LSARG referenced in function MAIN__    Flusso.obj  

I guess the error is related to LSARG but I don't know how to fix it. Do you have any suggestions?

I attach the file. Thank you

 

0 Kudos
Highlighted
Black Belt
3 Views

Since FREQ is a locally

Since FREQ is a locally declared variable in your program, rather than a symbol that is defined in the NUMERICAL_LIBRARIES module, the XCEPT=>FREQ clause has no reason to exist. See #9.

The linker error in #10 is the result of your removing the linker directive in the INCLUDE file. Either restore the INCLUDE or specify the IMSL libraries as additional libraries to be scanned by the linker, in the project settings.

0 Kudos
Highlighted
Beginner
3 Views

As you suggested, I restored

As you suggested, I restored 'INCLUDE 'link_fnl_shared_imsl.h'. Now the program is compiled but than this error occurs:

1.JPG

What could cause this?

Could it be because in this subroutine I entered the dimension of FREQ (FREQ(10))?

!     ((THIS SUBROUTINE CRAET RIGHT HAND SIDE MATRIX - 10th Subroutine
!       {EQUATION [10-50] Frank L. Stasa}))
!    -----------------------------------------------------------------
	CALL RHSID(MTOTVC,ASEMC,ASEMG,CDISS,FRHSIDS,FREQ(10),FLUXFL)
!      CALL RHSID(MTOTVC,ASEMCO,CDIS,FRHSID,FREQ,FLUSSS)

 

Because if I don't enter it, this error occurs:

Error    2     error #6634: The shape matching rules of actual arguments and dummy arguments have been violated.   [FREQ]    #138

Thank you.

0 Kudos
Highlighted
Black Belt
3 Views

You have several arrays

You have several arrays dimensioned (5000,5000). Each of these will consume 100 MB of memory, and the total is much larger than the default stack size. You may find the /heap-arrays option helpful as an alternative to allocating on the stack.

With regard to the call to RHSID, you should not blindly add the subscript "(10)" just to quieten the compiler. Doing so will make your program work incorrectly, and detecting run-time errors is more difficult and time-consuming than detecting compile-time errors.

The shape matching error is as follows: the dummy argument FREQ in the subroutine RHSID has no explicit declaration. Therefore, it is taken to be a real scalar. In the call to this subroutine, however, the corresponding actual argument, FREQ, is an array. Both the actual and formal arguments may be scalars, or both may be arrays; you should not pass an array as an actual argument when a scalar is expected by the subroutine (let us ignore exceptional cases where this can be done without error).

You will need to track down what the original author's intention was before changing the program. We cannot advise you on that matter since this is a semantic question related to your application area, of which most of us know little.

0 Kudos
Highlighted
Beginner
3 Views

Do you suggest to enter a

Do you suggest to enter a high value of heap-arrays? Because I tried, but the same error occurs.

The subroutine RHSID aims to create an array. Should I enter an explicit declaration for the subroutine?

0 Kudos
Highlighted
Black Belt
3 Views

When using /heap-arrays,

When using /heap-arrays, leave the value at zero (if you provide one at all). Specifying a non-zero value has close to zero benefits.

The NUMERICAL_LIBRARIES module declares the "F77" interfaces for the IMSL routines.

Steve (aka "Doctor Fortran") - https://stevelionel.com/drfortran
0 Kudos
Highlighted
Black Belt
3 Views

Quote:Baioni, Elisa wrote:

Baioni, Elisa wrote:

The subroutine RHSID aims to create an array. Should I enter an explicit declaration for the subroutine?

Your subroutine RHSID fills the argument array FRHSID with values. That is not what one would call "creating" an array. The array already exists when RHSID is called, and has been allocated in one of the routines in the call chain. 

All the arguments of subroutine RHSID, except the first argument, are assumed-size arrays. The first argument conveys the size information. The arguments are implicitly typed, and correctly. Therefore, no explicit interface is needed. 

On the other hand, the code in RHSID is not efficient. In fact, some of the arguments could be dispensed with. Calls to this subroutine could be replaced with a direct call to the standard Lapack/MKL library routine SGEMV. 

0 Kudos
Highlighted
Beginner
3 Views

I replaced in line 138 the

I replaced in line 138 the RHSID with SGEMV, in this way the error ( error #6634: The shape matching rules of actual arguments and dummy arguments have been violated.   [FREQ]    #138) disappears. Moreover, I reduced the dimension of matrices and arrays so that I overcame the error of stack overflow. When I run the program this error occurs:

TERMINAL ERROR 6 from SGEMV. TRANS must be set equal to N or T or C while R is given.

What could cause this?

Thank you

0 Kudos
Highlighted
Black Belt
3 Views

Your routine RHSID and the

Your routine RHSID and the MKL routine SGEMV do not have the same argument lists. Please consult the documentation of SGEMV and modify your source code accordingly. 

Perhaps, you should first get your code to run correctly and then consider making changes to improve its speed. 

I suspect that you are attempting to rerun code that is a few years old, at least. It uses some non-standard features such as (i) DO index variable of type REAL and (ii) subscript of type REAL. Do you have any links to the code, and any test problems with known results that you can use to verify that your program is working correctly?

0 Kudos
Highlighted
Beginner
3 Views

No, I have nothing to verify

No, I have nothing to verify the program.
The developer of the code confirmed that the routine 
RHSID is correct and that the code worked for him.
I checked the dimension of arrays, but I continue to have the same error:

Error    2     error #6634: The shape matching rules of actual arguments and dummy arguments have been violated.   [FREQ]    #138    

What should I do?

Thank you

0 Kudos
Highlighted
Black Belt
3 Views

It appears to me that the

It appears to me that the program was originally written to perform a calculation for a single value of FREQ, and subsequently modified to work with many values of FREQ. If so, an appropriate element of FREQ, perhaps FREQ(ISTEP), should be passed as an argument to RHSID, rather than the array FREQ. You must ask the author of the program if this is so, since it is hard for someone like me, who is not familiar with the subject area, to guess the intentions behind the program, which is not small enough to understand by glancing at it.

0 Kudos