Fortran debugging help: faulty pointers?

Click For Summary
SUMMARY

The forum discussion centers on debugging a Fortran program compiled with the NAG Fortran Compiler (nagfor) using specific flags for debugging. The user encounters a runtime error indicating a reference to an undefined variable, OPT%INDEX, in cell_test.f90 at line 75. The discussion suggests that the primary issue is related to this undefined variable rather than memory deallocation messages. The user suspects either a float overflow or a null pointer reference as potential causes of the error.

PREREQUISITES
  • Understanding of Fortran programming language
  • Familiarity with NAG Fortran Compiler (nagfor) and its debugging flags
  • Knowledge of variable scope and memory management in Fortran
  • Basic debugging techniques for runtime errors in programming
NEXT STEPS
  • Review Fortran variable declaration and initialization practices
  • Learn how to use NAG Fortran Compiler debugging flags effectively
  • Investigate techniques for identifying and resolving null pointer references in Fortran
  • Explore methods for detecting and handling float overflows in numerical computations
USEFUL FOR

This discussion is beneficial for Fortran developers, particularly those debugging runtime errors and managing memory in their applications. It is also useful for programmers seeking to enhance their understanding of variable management and debugging techniques in Fortran.

ASGtFT
Messages
10
Reaction score
0
Hi, I tried compiling my program in Fortran using the following commands:

Code:
nagfor -g90 -C=all -C=undefined -g -gline -nan -u -mtrace=all test09b.f90 cell_functions.o -o test09b

I ended up getting this error message:

[Allocated item 15285 (size 17) = Z'FFFFFFFFB744A790']
Runtime Error: cell_test.f90, line 75: Reference to undefined variable OPT%INDEX
Program terminated by fatal error
test09b.f90, line 79: Error occurred in TEST08
[Deallocated item 2 (size 1025, at Z'FFFFFFFFB741B430')]
[Deallocated item 3 (size 1025, at Z'FFFFFFFFB741B850')]
[Deallocated item 15284 (size 1025, at Z'FFFFFFFFB744A370')]
[Deallocated item 15285 (size 17, at Z'FFFFFFFFB744A790')]
[Deallocated item 6 (size 65537, at Z'FFFFFFFFB741C320')]
[Deallocated item 7 (size 21, at Z'FFFFFFFFB742C340')]
[Deallocated item 1 (size 1025, at Z'FFFFFFFFB741B010')]
Aborted

I'm not sure exactly what this means. Is the error the bit which says "Runtime Error: cell_test.f90, line 75: Reference to undefined variable OPT%INDEX", or is it the bit below, which says "test09b.f90, line 79: Error occurred in TEST08
[Deallocated item 2 (size 1025, at Z'FFFFFFFFB741B430')]...etc"?

At the moment I think the problem is either a float overflow (which I don't really know how to spot, much less fix), or I've referenced a null pointer.

I'm not really sure how to solve either problem, does anyone have any suggestions? Thanks!
 
Physics news on Phys.org
ASGtFT said:
Hi, I tried compiling my program in Fortran using the following commands:

Code:
nagfor -g90 -C=all -C=undefined -g -gline -nan -u -mtrace=all test09b.f90 cell_functions.o -o test09b

I ended up getting this error message:

[Allocated item 15285 (size 17) = Z'FFFFFFFFB744A790']
Runtime Error: cell_test.f90, line 75: Reference to undefined variable OPT%INDEX
Program terminated by fatal error
test09b.f90, line 79: Error occurred in TEST08
[Deallocated item 2 (size 1025, at Z'FFFFFFFFB741B430')]
[Deallocated item 3 (size 1025, at Z'FFFFFFFFB741B850')]
[Deallocated item 15284 (size 1025, at Z'FFFFFFFFB744A370')]
[Deallocated item 15285 (size 17, at Z'FFFFFFFFB744A790')]
[Deallocated item 6 (size 65537, at Z'FFFFFFFFB741C320')]
[Deallocated item 7 (size 21, at Z'FFFFFFFFB742C340')]
[Deallocated item 1 (size 1025, at Z'FFFFFFFFB741B010')]
Aborted

I'm not sure exactly what this means. Is the error the bit which says "Runtime Error: cell_test.f90, line 75: Reference to undefined variable OPT%INDEX", or is it the bit below, which says "test09b.f90, line 79: Error occurred in TEST08
[Deallocated item 2 (size 1025, at Z'FFFFFFFFB741B430')]...etc"?
I would start by looking at the first error line, the one with OPT%INDEX. If you need some help, please show us your code.
ASGtFT said:
At the moment I think the problem is either a float overflow (which I don't really know how to spot, much less fix), or I've referenced a null pointer.

I'm not really sure how to solve either problem, does anyone have any suggestions? Thanks!
 

Similar threads

  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 4 ·
Replies
4
Views
3K