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

Severe 408 error message that is puzzling



I'm running Visual Fortran Composer 2013 inside Visual Studio 10, Windows 7 64 bit, 128 GB RAM.

I wrote a program that computes elements in matrices. The program works fine for pretty large input files.

Now I want to increase the size of the input file and all works well (more than enough memory is available) until the

program terminates with:

forrtl: severe <408>: fort: <10>: Subscript #1 of the array ZGPf has value 2147443984 which is greater than the upper bound of 48372.

Reading about such errors on the net, I see that the common problem is that people use variables without initializing them first. The number that I've encountered (2147443984) looks like a junk number but the fact is that the variable that is giving me the problem is a loop variable and thus cannot have a junk number since it is given a definite value at the start of each loop. Here is the problematic part of the code:

Subroutine CreateImpMat(L)

integer :: nbf, it, nf, ibf, nt

complex (8), dimension (size(L%Inzt)+1) :: ZGPt  ! checking this dimension size gives 250 which is correct.

complex (8), dimension (size(L%Inzf)+1) :: ZGPf  ! checking this dimesnion size gives 48,372 which is correct.

nf = size(L%Inzf) ! this equals 48,371

nbf = size(L%I) ! this equals 60,000

nt = size(L%Inzt) ! this equals 249.

do ibf = 1, nbf

     do it = 1, nt

          ZGPt(it) = calcElectric (......)  ! this calls "calcElectric" which does some calculations. The output from this function is correct.

     end do     ! this loop works fine always no matter the size of my input file.

     do it = 1, nf

          ZGPf(it) = calcElectric (......) ! this calls "calcElectric" which does some calculations. The output from this function is correct.

     end do   !    This loop gives me the error "severe <408>..." for the last value of 'it' which should be 48,371. Up to and including 48,370 all is fine.

end do

end subroutine CreateImpMat

What I'm understading from this code along with the error message is that the problem is with 'it'. But as you can see 'it' has a definite value which is why I don't understand the 'junk' number 2147443984. For smaller input files the program works great. Also, I cannot think of a problem happeing in the function "calcElectric" because 'it' is a local variable and would not change values while another function is running. Another thing I tried was printing the value of 'it' while doing the inner problematic loop and it does have a correct value. I also tried defining another complex variable and giving it the output of the "calcElectric" function and only then putting this value in ZGPf(it). Still the same error message.

Can anyone explain what's happening here? Could this be a visual fortran bug?

Thank you,


0 Kudos
4 Replies

I want to add that deleting the original code in function "calcElectric" to calcElectric=8 , produces no errors. My thoughts are that something is happening in calcElectric (which itself calls another function) although none of them touch 'it' (which is local to the CreateImpMat subroutine). Also, the error message that I'm currently getting is then unclear. Why would the error be on 'it' which is well defined? 

0 Kudos

Your variable "it" is a local variable, usually declared on the stack.

It's possible that something happening within calcElectric (or one of the routines it calls) is writing trash on the stack.

If some of these routines are using a different calling interface, such as stdcall or cvf, that might provoke a problem.

Is calcElectric declared to be returning a complex*8?   I was concerned when you said you'd hardcoded it to return "8" ..

Finally, I guess I don't know what you mean by "size of your input file" ... how does that come into play here?


0 Kudos
Honored Contributor III

Yair, your description of the problem is incomplete, and takes us along the same path that failed to help you pinpoint the error. I think that to make any progress we need to see a complete (and, preferably small) code example that shows the error when run. Please state the compiler options in effect.

I notice that you did not have traceback enabled, as far as your reported error message shows. What do you see when you recompile with /traceback and run with the problematic input data?

0 Kudos


Thank you for your responses.

After more testing it turns out I misjudged where the bug occurs and my guess as to its nature. Trying out different

input files (each input file has a different number of unknows that need to be solved) I saw that the bug turns out

at a slightly different place in this subroutine. Finally I found out its nature. There was a place in the code (that I did not point out since it does a very basic operation, or so I thought) that as the input files got larger had to do multiplication between two number until it had reached the maximum integer value of 2,147,483,647 which afterwards gave me junk numbers. As long as the multiplication was below this number the program ran fine but above it I started getting problems.
I learned 2 things from this:
1. I need to set the integer values to be compatible with 64 bits which would allow me larger integer numbers.

2. As "mecej4" pointed out, in order to debug a code we need the complete listing of the problematic area of the code and not suffice with pseudo or partial code.

Thank you guys. I appreciate the time you spent to reply.

0 Kudos