This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
<optimized out>
- From: Der Herr Hofrat <der dot herr at mail dot hofr dot at>
- To: gcc-help at gcc dot gnu dot org
- Date: Mon, 2 Sep 2002 13:19:34 +0200 (CEST)
- Subject: <optimized out>
HI !
how can I prevent GCC from optimizing away a specific variable ?
lets say I have something trivial like
int i;
i=3;
printf("%d\n",i);
then gcc with -O2 seems to directly push 3 on the stack and call printf
and never used a local variable so I can't access it in the debuger. Is
there any simply way of preventing this other than doing stupid things like
introducing some useless statements to force a local variable but without
turning of -O2 for the entire file ???
hofrat