From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23137 invoked by alias); 2 Sep 2002 12:50:34 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 23121 invoked from network); 2 Sep 2002 12:50:33 -0000 Received: from unknown (HELO hofr.at) (80.120.128.82) by sources.redhat.com with SMTP; 2 Sep 2002 12:50:33 -0000 Received: (from root@localhost) by hofr.at (8.10.2/8.9.3/SuSE Linux 8.9.3-0.1) id g82Brnp29702; Mon, 2 Sep 2002 13:53:49 +0200 From: Der Herr Hofrat Message-Id: <200209021153.g82Brnp29702@hofr.at> Subject: Re: In-Reply-To: <616BE6A276E3714788D2AC35C40CD18D56176B@whale.softwire.co.uk> from Rupert Wood at "Sep 2, 2002 01:38:00 pm" To: Rupert Wood Date: Mon, 02 Sep 2002 05:50:00 -0000 CC: "'Der Herr Hofrat'" , gcc-help@gcc.gnu.org MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-SW-Source: 2002-09/txt/msg00011.txt.bz2 > 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