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

beginner problem

wgriggdraper_com
Beginner
652 Views

Hi All,

I am new to Visual Fortran, although I did use Fortran back in college MANY years ago. In any cae, I have inherited a whole bunch of code most of which I have managed to build and execute with no problem. However, I am getting an error in one routine that has to do with uninitialized memory. I looks like the following:

...

REAL*8

...

TEMP1(3,3), TEMP2(3,3), TEMP3(3,3), TEMP4(3,3)

CALL

MAKMAT ( BRG, 3, DEG$, TEMP1 )

...

SUBROUTINE MAKMAT ( ANGLE, IAXIS, UNIT$, ROTMAT )

DIMENSION ROTMAT(3,3)

...

When I inspect the parameters that are passed to MAKMAT everything looks good except for ROTMAT. It shows a 3 by 3 array where all 9 values have "Undefined address". When I inspect TEMP1 before calling MAKMAT it shows a 3 by 3 array initialized to zero. I have enabled all compiler and runtimeerror checks (bounds, etc) and nothing shows up.

Any ideas?

TIA,

Bill

0 Kudos
2 Replies
Les_Neilson
Valued Contributor II
652 Views
Assuming the code is something like this :
REAL*8 TEMP1(3,3), TEMP2(3,3), TEMP3(3,3), TEMP4(3,3)

CALL

SUBROUTINE MAKMAT ( ANGLE, IAXIS, UNIT$, ROTMAT )

DIMENSION ROTMAT(3,3)

MAKMAT ( BRG, 3, DEG$, TEMP1 )

unless otherwise specified :
Implicit typing means BRG and ANGLEwill be REAL*4 that's ok
3 and IAXIS by the same will be INTEGER that's ok.

BUT TEMP1 is REAL*8 and implicit typing means ROTMAT is REAL*4 so they don't match.

The usual advice at this point is to

(a) in the debug configuration under Project->Properties->Fortran->Diagnostics
turn on "Generate Interface Blocks"
and "Check Routine Interfaces"
(You could also turn on warnings for undeclared & unused variables)

(b)put IMPLICIT NONE in all of your routines.

Les

0 Kudos
Les_Neilson
Valued Contributor II
652 Views
Seems I messed up editing the "quote"
the CALL and the routine being called, MAKMAT, got seperated.
Sorry about that.
Les
0 Kudos
Reply