This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/39298] Optimize away only set but not used variable
- From: "burnus at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 25 Feb 2009 10:35:15 -0000
- Subject: [Bug middle-end/39298] Optimize away only set but not used variable
- References: <bug-39298-13404@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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