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

COMMON BLOCK Problem

temgy1986
Beginner
553 Views

When I compiled und linked a old fortran 77 program with intel Fortran Compiler, some COMMON BLOCK variables got changed (reset to 0) after calling some unrelevant subrutines. I have also tried with CVF6.5, but there is no such problem. Does anyone here also meet this problem?

0 Kudos
2 Replies
jparsly1
New Contributor I
553 Views
Quoting - temgy1986

When I compiled und linked a old fortran 77 program with intel Fortran Compiler, some COMMON BLOCK variables got changed (reset to 0) after calling some unrelevant subrutines. I have also tried with CVF6.5, but there is no such problem. Does anyone here also meet this problem?


When variables change unexpectedly, something is happening that causes the memory to be overwritten.

Some that come to mind are mismatched arguments ( either number or kind) in subroutine calls, and
out of bound array references. Uninitialzed variables can also bite you.

The compiler can catch some of these errors if you have the right debugging options turned on.

Different behavior between compilers is certainly possible for this type of error, since they will vary in
how they locate variables within the programs memory.


0 Kudos
jimdempseyatthecove
Honored Contributor III
553 Views

To catch the problem, get the hex address of the variable being changed (position the memory dump window on the variable), using the hex address (you can select and copy), open Debug | Windows | Breakpoints select data break as C++ (no Fortran selection) and paste in the hex address. Use 4 bytes to watch as I think 8 bytes have a problem.

add the break each time you make a test run and do so prior to the corruption.

You may have a missing or moved common block and/or equivilence.

OR

This may be a very old bug that was not uncovered until now.

Jim Dempsey
0 Kudos
Reply