Fortran debugging help: faulty pointers?

In summary, the conversation is about a compilation error that occurred while trying to compile a program in Fortran. The error message indicates a reference to an undefined variable and an error occurring in a specific function. The person is unsure about the cause and asks for suggestions on how to solve the problem.
  • #1
ASGtFT
10
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
  • #2
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!
 

FAQ: Fortran debugging help: faulty pointers?

What is a faulty pointer in Fortran?

A faulty pointer in Fortran refers to a programming error where a pointer is pointing to an incorrect memory location or is not pointing to any valid memory location at all. This can cause unexpected program behavior and often results in program crashes.

How do I identify a faulty pointer in my Fortran program?

To identify a faulty pointer, you can use a debugging tool or enable debugging options in your Fortran compiler. These tools can help you track the values of your pointers and identify any incorrect or null pointers.

What can cause faulty pointers in Fortran?

Faulty pointers in Fortran can be caused by a variety of factors, including incorrect use of pointer assignment or deallocation, improper initialization of pointers, and accessing memory locations that have already been deallocated.

How can I prevent faulty pointers in my Fortran code?

To prevent faulty pointers, it is important to carefully manage the use of pointers in your code. Always ensure that pointers are properly initialized, used, and deallocated. It is also helpful to use debugging tools during development to catch any potential issues before they cause problems.

What are some common techniques for debugging faulty pointers in Fortran?

Some common techniques for debugging faulty pointers in Fortran include using print statements to track the values of pointers, using a debugger tool to step through the code and examine memory locations, and using compiler options for pointer checking and error detection.

Similar threads

Replies
3
Views
2K
Replies
4
Views
2K
Replies
4
Views
3K
Back
Top