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

Error: the storage extent of the dummy argument exceeds that of tthe actual argument

Andrijana_S_
Beginner
2,744 Views

Error: the storage extent of the dummy argument exceeds that of the actual argument [TW]

Hi everybody, could someone help me,

I have changed my code by adding a new subroutine CALTW which calculate temperature TW(NX, NYW, NZ) in new wall sublayer, but variable FI (NX, NY, NZ) which solves equation for TW has different extent  but I need an old value and a new one

Ana

 

0 Kudos
11 Replies
Les_Neilson
Valued Contributor II
2,744 Views

In subroutine CALTW you didn't specify the size of ALFA1

Les

0 Kudos
mecej4
Honored Contributor III
2,744 Views

Andrijana, your program code is not compilable: (i) the include files, of which there are many, are missing, and (ii) the file that you provided is not properly formatted as fixed format Fortran source -- for example, line-37 has "Common" starting in column 6.

I have changed my code
Such comments are not informative since we do not have any knowledge of the original code that you changed.

0 Kudos
Steven_L_Intel1
Employee
2,744 Views

As an example of what can trigger this error:

program test
integer arr(3)
call sub (arr)
end
subroutine sub (a)
integer a(10)
end subroutine sub

With the "generated interface checking" feature on, which is the default in a Debug configuration, the compiler can see that you're passing a 3-element array "arr" to a 10-element array "a". This is not legal in Fortran, but many older compilers didn't detect the error. Usually it's best to use assumed-size arrays for dummy arguments so as not to make any assumptions about the array size. In this case, "a" should be declared as a(*).

The same goes for character arguments. It's a common error to declare the dummy argument some longer character length but pass a shorter value to it. Use character(*) in such cases.

0 Kudos
Andrijana_S_
Beginner
2,744 Views

Thank you, I'll try to solve my problem. when I compile it in Fortran 90 it register DOMAIN error, not extent of dummy argument but probably  it is the same error?

0 Kudos
Lorri_M_Intel
Employee
2,744 Views

Can you post the actual error please? 

I usually consider "DOMAIN errors" to be runtime errors, not compile-time errors.
And usually they are caused by invalid data.

Please note that variables are not implicitly initialized to anything - if you need a variable to have a specific initial value, including 0, you must set it yourself.   That is a frequent cause of run time "DOMAIN errors"

               --Lorri

0 Kudos
Steven_L_Intel1
Employee
2,744 Views

I would also ask what you mean by "compile it in Fortran 90". What command do you use to do that compile?

0 Kudos
Andrijana_S_
Beginner
2,744 Views

Sorry I've made a mistake last time, here is my error:  run-time error M6201: MATH   sqrt:DOMAIN error

I have a variable FI(NX+2, NY+2, NZ+2) in soubroutine SOLV(FI, AP, ...)  which is a dummy argument and actual argument is TW(NX+2, NYW+2, NZ+2), NYW=10, NY=40 in call SOLV(TW, AP,...). How can I change extent of FI to save it'sdimension for other variables?

Thank you!

0 Kudos
Steven_L_Intel1
Employee
2,744 Views

I don't think Intel Fortran can give you the M6201 error. Are you sure that is coming from code compiled with Intel Fortran?

You say that the second dimension of the actual argument is NYW+2, but the dummy is NY+2. Are these supposed to be the same?

0 Kudos
Andrijana_S_
Beginner
2,744 Views

I am new in Fortran programing and not sure that understand you. In Visual Studio 2010 I have an error : the storage extent of dummy argument exceeds that of the actual argument (TW) when I use command build solution. Actually Subroutine SOLV is solving differential equations for variables representing FI. I guess that the problem is in TW which second dimension is lower than FI, that are supposed to be the same.

When I run this program in older version/I have to check which one, it has run time error. there are in this program external subroutines which I didn`t send

 

 

0 Kudos
DavidWhite
Valued Contributor II
2,744 Views

Adrijana,

The storage extent error means that the array sizes in the calling routine and in the subroutine are different, as shown in the example code Steve gave.

You need to go through your code and check each CALL statement to see that all of the arguments are in the correct order, and that none of them have been misspelled.  This is a particular risk, since this is older code, which is not using the modern IMPLICIT NONE statement, and so all variables are automatically typed, and any misspelled variables are automatically usable.

For example if a variable defining the size of the array is misspelled in one of the common blocks, but is has been used correctly in defining the array, this array size will not be initialized, and so the size of the array in the subroutine will not be what you expect.

Hope this points you in the right direction to solving the errors in your code.

David

0 Kudos
Les_Neilson
Valued Contributor II
2,744 Views

Andrijana Steve's comment is that you say the error is M6201 which does not appear to be an Intel Fortran error.

All of your calls to SOLV, except one, have the actual and dummy arguments the same shape and size. For the remaining one you are passing an actual array TW to the dummy array FI but the sizes differ, which is what the compile message is saying. You are asking if the specification for FI can be made such that actual arrays of different sizes can be passed to it.

The answer is yes, but you would have to change your code. Being new to Fortran you would need to read about "Assumed-Shape" and "Explicit Interfaces"

In your main program you would need to create an Interface for SOLV along the lines of:

interface

    subroutine solv(a, b, c, .......)

    real, dimension(:,:,:) a

etc.

    end subroutine solv

<code>

   call solv(tw, ....)

   end program main

   subroutine solv(fi, ........)

   real, dimension(:,:,:) fi

etc.

    end subroutine solv

Hope this helps.

Les

0 Kudos
Reply