views:

53

answers:

1

Hey you guys,

i think i wont find that in any textbook, because answering this takes experience. i am currently in the stage of testing/validating my code / hunting bugs to get it into production state and any errors would lead to many people suffering e.g. the dark side.

What kind of flags do you set when you compile your program for fortran for debugging purposes?

What kind of flags do you set for the production system?

what do you do before you deploy ?

Looking forward to hearing from you.

cheers

edit: the production version uses ifort as a compiler, yet i do my testing with gfortran. doing it wrong?

+1  A: 

-O0 -g obviously.

There are a plenty of them. The most useful from my point of view are:

-Wall to "enable all the warnings about constructions that some users consider questionable, and that are easy to avoid (or modify to prevent the warning), even in conjunction with macros."

-Wextra to "enable some extra warning flags that are not enabled by -Wall."

-pedantic to generate warnings about language features that are supported by gfortran but are not part of the official Fortran 95 standard. It possible to be even more "pedantic" and use -std=f95 flag for warnings to become errors.

-fimplicit-none to "specify that no implicit typing is allowed, unless overridden by explicit IMPLICIT statements. This is the equivalent of adding implicit none to the start of every procedure."

-fbounds-check to "generate additional code to check that indices used to access arrays are within the declared range."

-fbacktrace to "specify that, when a runtime error is encountered or a deadly signal is emitted (segmentation fault, illegal instruction, bus error or floating-point exception), the Fortran runtime library should output a backtrace of the error."

kemiisto