This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: <optimized out>
- From: Der Herr Hofrat <der dot herr at mail dot hofr dot at>
- To: Rupert Wood <me at rupey dot net>
- Cc: "'Der Herr Hofrat'" <der dot herr at mail dot hofr dot at>, gcc-help at gcc dot gnu dot org
- Date: Mon, 2 Sep 2002 13:53:49 +0200 (CEST)
- Subject: Re: <optimized out>
> Der Herr Hofrat wrote:
>
> > 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 ???
>
> Not sure why you'd want to do this unless you've got problems with the
> optimized code; you could always debug at -O0.
>
> However, declaring the variable a 'volatile' ought to do what you want.
yup - thanks volatile int i; did it.
thx !
hofrat