Program crashes at integer-assignment

Hi!

My program crashes and I try to debug it in pgdbg. All makefiles have flag -g to generate debug info and flag -C for arraybound checking.
At the point in the subroutine where the program crashes, I try to pass the value of integer KTSTEP (with INTENT(IN) and entering the subroutine with value 6) to integer MTSTEP (with INTENT(OUT)). The “Locals” window from pgdbg shows that, just before the crash, indeed KTSTEP has the value 6. Concerning MTSTEP the “Locals” window is less optimistic:

mtstep = ERROR: cannot read value at address 0x4.

My impression is that this message in the “Locals” window reflects that (not surprisingly) INTENT(OUT)-variable MTSTEP has not been initialized. Then comes my program statement:

MTSTEP = KTSTEP

Stepping over this statement generates a crash with message:

! Signalled SIGSEV at 0x80889b9, function puf_initio, file puf_initio.f90, line 115

Can someone please hint me how to proceed? Can I set stronger compilation-flags for all sorts of checks? Does the fact that the “Locals” window told me about MTSTEP that “ERROR: cannot read value at address 0x4” contain a non-trivial message? If so, what can I do?

Thanks for any suggestion,

Regards,


Arjan

Hi Arjan,

If mtstep was unitialized, then the debugger would still print out a value, albeit garbage. My best guess is that you have an argument mismatch between the caller and callee, and MTSTEP doesn’t have an associated caller variable. If this is indeed the case, then the best way to avoid this common error is to add interfaces for your rountines. This way the compiler can check for argument mismatches.

  • Mat