From owner-freebsd-stable Mon Oct 21 10:43:49 2002 Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B4BE237B401 for ; Mon, 21 Oct 2002 10:43:47 -0700 (PDT) Received: from mtiwmhc11.worldnet.att.net (mtiwmhc11.worldnet.att.net [204.127.131.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1274843E77 for ; Mon, 21 Oct 2002 10:43:47 -0700 (PDT) (envelope-from cswiger@mac.com) Received: from prime ([12.88.94.90]) by mtiwmhc11.worldnet.att.net (InterMail vM.5.01.05.12 201-253-122-126-112-20020820) with SMTP id <20021021174345.PXCB20156.mtiwmhc11.worldnet.att.net@prime> for ; Mon, 21 Oct 2002 17:43:45 +0000 Message-ID: <006501c27929$67cf3cd0$0301a8c0@prime> From: "Charles Swiger" To: References: <20021019130404.A25131-100000@edge.foundation.invalid> <001901c27798$d033df70$0301a8c0@prime> <3DB2399F.3060900@zbzoom.net> <003a01c27849$6367d4d0$0301a8c0@prime> <20021021161902.GA396@HAL9000.homeunix.com> Subject: GCC options, was: Re: 4.7-RELEASE crash [file system] Date: Mon, 21 Oct 2002 13:43:15 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1106 X-Mimeole: Produced By Microsoft MimeOLE V6.00.2800.1106 Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG David Schultz wrote: > Thus spake Charles Swiger : >> PS: Arguably, people should be building with "-g -O" all of the >> time, even in production. GCC tends to generate the most reliable >> code for that combination of options, as those are exercised the >> most frequently. > > GCC specifically does *not* generate code that is any more or less > reliable when you use -g. The GCC folks are fairly picky about > that rule. The GCC team wants the compiler to produce reliable code under all circumstances, most likely. What the compiler actually does may not correspond perfectly to that intention. > As for optimization, I've never been bitten by any bugs in either -O0 or -O, > but in theory -O0 would save you from any bugs in the optimizer. -O0 means to disable the optimizer, agreed. However, the optimizer isn't a single thing; it's an entire range of individual optimization techniques. Different -O levels (-O0, -O, -O2, etc...) enable different combinations. Using -g may change some of the optimizations, such as disabling "-fomit-frame-pointer", if they are incompatible with symbolic debugging. It also has other implications on certain platforms, such as the HP/PA RISC and probably the SPARC, as those platforms tend to pass arguments in registers rather than putting them on the stack-- although the _space_ in the stack frame is reserved, but the contents may not be written there. On such platforms, -g tells the compiler to emit code to always write the arguments to the stack, which is useful when debugging. On the HP, that means that even leaf procedures need to allocate a stack frame rather than the callee using their caller's frame. (HP uses twisted calling conventions.) On the SPARC, that probably means something like a call FLUSHW, to flush the "register windows" used by that CPU architecture. -Chuck To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message