I think I won\'t 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
For debugging I use: -O2 -fimplicit-none -Wall -Wline-truncation -Wcharacter-truncation -Wsurprising -Waliasing -Wimplicit-interface -Wunused-parameter -fwhole-file -fcheck=all -std=f2008 -pedantic -fbacktrace
. For ones not already explained, check the gfortran manual. -fcheck=all
includes -fcheck=bounds
.
For production I use: -O3 -march=native -fimplicit-none -Wall -Wline-truncation -fwhole-file -std=f2008
. Runtime checks such as bounds checking increase the execution time of the resulting executable. I've found the cost to frequently be surprisingly low, but it can be high. Hence no runtime checks on compiles for production.