[Bug middle-end/39298] Optimize away only set but not used variable

burnus at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Wed Feb 25 10:35:00 GMT 2009



------- 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



More information about the Gcc-bugs mailing list