0

I am trying to debug with GDB, and am encountering an arithmetic error when trying to compare two values.

The first value is set at the top of the module as double precision, parameter, public :: Dint = -1.D99

The second value happens to be inta = 102 inside the subroutine being called.

The comparison happens within a subroutine as If (Inta /= int(Dint)) then

I've tried looking at the value for Dint by typing p Dint, but it says it is not in current context. I suspect it may have been optimized out, or perhaps there is a certain syntax needed to see variables at the top of a module.

I also suspect maybe there could be an issue in attempting to convert this double precision to an integer, but I think it is working in other cases.

Any insight might be helpful.

francescalus
  • 30,576
  • 16
  • 61
  • 96
Jacob Shirley
  • 63
  • 1
  • 4
  • 2
    `Dint` is not a variable. It is a named constant. gfortran (and likely all other compilers) explicitly replaces references to a named constant by its value during compilation. What options are you using to try to debug your issue? If you are not using `-fcheck=all -Wall -Werror -fmax-error=1 -ffpe-trap=invalid,zero`, then you are doing something wrong. – evets Oct 23 '20 at 16:59
  • 2
    Forgot to ask. What you trying to accomplish with `if (inta /= int(Dint))`? The value of `Dint` exceeds `huge(1)`, and thus `int(Dint)` is meaningless. – evets Oct 23 '20 at 17:05
  • It'd be helpful if you could upload a small program that highlights just the section of the comparison. Maybe there is a better way to achieve your goal.. – jack Oct 25 '20 at 13:28

0 Answers0