Localizing a Fortran Error - Get the Position of the Error

Click For Summary

Discussion Overview

The discussion revolves around localizing a runtime error in Fortran related to a "floating divide by zero" message. Participants explore methods to identify the source of the error within the code, focusing on debugging techniques and potential causes of the division by zero issue.

Discussion Character

  • Technical explanation
  • Exploratory
  • Debate/contested

Main Points Raised

  • One participant seeks help in identifying where a division by zero occurs in their Fortran code.
  • Others suggest using debugging tools like gdb to trace the error's location and recommend print statements to isolate the problem.
  • Some participants discuss the possibility that the error is not directly on line 73, but rather a code convention indicating a division by zero.
  • A suggestion is made to modularize calculations into sub-programs to facilitate error localization.
  • Concerns are raised about potential zero values being introduced in calculations, particularly when using floating-point operations.
  • Participants discuss the implications of using "implicit none" in Fortran, emphasizing the importance of explicit variable declarations.
  • One participant identifies a specific subroutine, "ffset," as a potential source of the error but is unsure of how it could lead to a division by zero.
  • There is speculation that the error may arise from variable initialization or subsequent calculations after calling "ffset."
  • Another participant highlights the need to check for divisions by zero in the context of the "DCMPLX" function and its operations on variable "s."

Areas of Agreement / Disagreement

Participants express various viewpoints on the potential sources of the error, and while some suggestions are agreed upon, there is no consensus on the exact cause or solution to the division by zero issue.

Contextual Notes

Participants note the complexity of the existing code and the challenges of tracking variable values across multiple files and subroutines. There are unresolved questions regarding the initialization of variables and the flow of data through the program.

  • #31
The problem disappeared when I switched compiler from iFort to g77!
Many thanks for your help anyway!
 
Technology news on Phys.org
  • #32
The mighty ifort "falls" to g77 ... oh boy :-p .
 
  • #33
Putting on someone else's shoes is almost never a good idea. Unless they fit, that is.

That must have been a pretty painful fit, to be worth 3 pages of frantic posts.

Glad you got that sorted out. :biggrin:
 
Last edited:
  • #34
Thing is, I didn't chose compiler to begin with. There's a ranking list built into the code such that ifort is automatically chosen first. Only if there's no ifort installed it goes on to the next compiler on the list...
When I took away ifort from PATH, g77 was chosen and everything (well, at least this specific problem) worked out well.
 

Similar threads

  • · Replies 17 ·
Replies
17
Views
7K
  • · Replies 5 ·
Replies
5
Views
5K
Replies
8
Views
4K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 9 ·
Replies
9
Views
2K
Replies
7
Views
3K
  • · Replies 8 ·
Replies
8
Views
4K
  • · Replies 2 ·
Replies
2
Views
8K
  • · Replies 7 ·
Replies
7
Views
4K
  • · Replies 6 ·
Replies
6
Views
3K