This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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



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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]