I'm attempting to debug some code which I'm writing as an extension to a much larger program. I'm pretty sure I'm corrupting memory somewhere, but for practical reasons (long run time), it's not really possible for me to run it through valgrind.

Instead, I'm trying to locate the source of my error using the -fcheck=bounds option for the gfortran compiler. Unfortunately, this picks up some fairly innocuous errors in the main program and halts before reaching any of my own code.

Is it possible to have the program continue operation after finding one of these runtime errors? In other words, can runtime error checks be turned into warnings rather than fatal errors?


  • 2
    I think that you are avoiding what you know is the right thing to do -- fix the so-called innocuous errors. If you know that your program wanders off the ends of arrays you know it's wrong. – High Performance Mark Apr 21 '15 at 16:27
  • Indeed, this probably is the right thing to do, but the code in which the errors occur isn't my own, it's part of a large and complex FEM code, and I don't really have time to learn its function to diagnose the errors. – Joe Todd Apr 22 '15 at 16:46
  • You could compile your own code with -fcheck-bounds -g the other code with -g (not -fcheck-bounds) and lastly, link with -fcheck-bounds, but as HPM, if bounds errors occur in the main program, chances are that it is doing something wrong is extremely high, I would never trust a program like that... :( – zeroth Dec 7 '15 at 22:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.