From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10562 invoked by alias); 6 May 2003 17:17:39 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 10551 invoked from network); 6 May 2003 17:17:39 -0000 Received: from unknown (HELO aragorn.inter.net.il) (192.114.186.23) by sources.redhat.com with SMTP; 6 May 2003 17:17:39 -0000 Received: from zaretsky (cable-128-29.inter.net.il [213.8.128.29]) by aragorn.inter.net.il (Mirapoint Messaging Server MOS 3.2.2-GA) with ESMTP id ANW98913; Tue, 6 May 2003 20:16:46 +0300 (IDT) Date: Tue, 06 May 2003 17:17:00 -0000 From: "Eli Zaretskii" To: robertso@somerset.sps.mot.com Message-Id: <7263-Tue06May2003201324+0300-eliz@elta.co.il> CC: dvenkat@noida.hcltech.com, delzhao_linux@yahoo.com, gdb@sources.redhat.com In-reply-to: <20030506125159.GB9470@somerset.sps.mot.com> (message from Jim Robertson on Tue, 6 May 2003 07:51:59 -0500) Subject: Re: Why GCC/ GDB ignore a normal C statement? Reply-to: Eli Zaretskii References: <20030505113250.55949.qmail@web20709.mail.yahoo.com> <1052211765.4348.39.camel@albatross> <20030506125159.GB9470@somerset.sps.mot.com> X-SW-Source: 2003-05/txt/msg00079.txt.bz2 > Date: Tue, 6 May 2003 07:51:59 -0500 > From: Jim Robertson > > > > Optimization should be used only for the final > > release. This is a common mistake made by new users. > > This may be getting (a little) off topic, but I disagree with the > above. Only turning on optimizations for a "final release" can have > unexpected consequences. Optimizations have a way of uncovering bugs > that go undetected in non-optimized code. At a minimum, testing should > be done with optimizations. Preferably, all development is done with > optimizations. I certainly second that. I do all my debugging builds with the full set of optimizations options. Modern debuggers no longer require you to choose between -g and -O; GDB certainly doesn't. A program compiled with and without optimizations are actually twio very different programs. So all of your test runs actually test a program that is different from what you are going to ship. Someone wise once compared testing an unoptimized program, then turning on optimization for the release to learning to swim in shallow waters with all the safety gear on, then throwing away that gear when you first plunge into the deep.