If i have the following declaration in my program:
logical, parameter :: verbose = .false.
will adding a bunch of things such as
if (verbose) write(*,*) "Information here"
affect the performance at all when compiling with "-03"? I would hope the compiler would recognize that the blocks are always false and thus completely remove them, so I can feel free to add debug-prints all over. Is this the case?
I guess this may be compiler dependent, but was hoping that there is a single answer for the most common compilers. If not, what is the behavior of gfortran?
Following the good advice of the commenters above, I tested this myself. It turns of that with gfortran, even optimization level -O0 appears to completely remove the dead write-blocks.