optimization - Will Fortran compilers completely remove always false if-blocks when optimizing? -


if have following declaration in program:

logical, parameter :: verbose = .false. 

will adding bunch of things such

if (verbose) write(*,*) "information here" 

affect performance @ when compiling "-03"? hope compiler recognize blocks false , remove them, can feel free add debug-prints over. case?

i guess may compiler dependent, hoping there single answer common compilers. if not, behavior of gfortran?

thanks in advance help.

following advice of commenters above, tested myself. turns of gfortran, optimization level -o0 appears remove dead write-blocks.


Comments