Fortran intent(inout) versus omitting intent

According to The Fortran 2003 Handbook by Adams, et al., there is one difference between an intent(inout) argument and argument without specified intent. The actual argument (i.e., in the caller) in the intent(inout) case must always be definable. If the intent is not specified, the argument must be definable if execution of the subroutine attempts … Read more

What flags do you set for your GFORTRAN debugger/compiler to catch faulty code?

Bare minimum -Og/-O0 -O0 basically tells the compiler to make no optimisations. Optimiser can remove some local variables, merge some code blocks, etc. and as an outcome it can make debugging unpredictable. The price for -O0 option is very slow code execution, but starting from version 4.8 GCC compilers (including the Fortran one) accept a … Read more

Fortran SAVE statement

In principal when a module goes out-of-scope, the variables of that module become undefined — unless they are declared with the SAVE attribute, or a SAVE statement is used. “Undefined” means that you are not allowed to rely on the variable having the previous value if you again use the module — it might have … Read more