------- Comment #4 from burnus at gcc dot gnu dot org 2009-02-25 10:35 ------- I did some testing with sunf95, icc and ifort.
sunf95 also puts the variable in .bss as gfortran does, while ifort puts it on the stack (unless explicitly declared as static ["SAVE"]). If the variable is static, neither of the compilers optimizes it away. a) Why are static variables not optimized away? (Not even in main()/MAIN_?) b) Is there something what one could do to get the advantage of not having huge variables on the stack but still allowing to optimize the variable away? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39298