From owner-freebsd-current Sun Feb 9 7: 1:30 2003 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E313A37B401; Sun, 9 Feb 2003 07:01:26 -0800 (PST) Received: from HAL9000.homeunix.com (12-233-57-224.client.attbi.com [12.233.57.224]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4007843F3F; Sun, 9 Feb 2003 07:01:26 -0800 (PST) (envelope-from dschultz@uclink.berkeley.edu) Received: from HAL9000.homeunix.com (localhost [127.0.0.1]) by HAL9000.homeunix.com (8.12.6/8.12.5) with ESMTP id h19F1KoH002301; Sun, 9 Feb 2003 07:01:20 -0800 (PST) (envelope-from dschultz@uclink.berkeley.edu) Received: (from das@localhost) by HAL9000.homeunix.com (8.12.6/8.12.5/Submit) id h19F1Kj8002300; Sun, 9 Feb 2003 07:01:20 -0800 (PST) (envelope-from dschultz@uclink.berkeley.edu) Date: Sun, 9 Feb 2003 07:01:20 -0800 From: David Schultz To: Adrian Chadd Cc: Terry Lambert , Ray Kohler , freebsd-current@freebsd.org Subject: Re: Compiling with high optimization? Message-ID: <20030209150120.GA2263@HAL9000.homeunix.com> Mail-Followup-To: Adrian Chadd , Terry Lambert , Ray Kohler , freebsd-current@freebsd.org References: <20030208173756.GA56030@arkadia.nv.cox.net> <20030208232724.GA20435@HAL9000.homeunix.com> <3E459BF3.BB3FC381@mindspring.com> <20030209002542.GA20812@HAL9000.homeunix.com> <20030209141006.GB33928@skywalker.creative.net.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030209141006.GB33928@skywalker.creative.net.au> Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Thus spake Adrian Chadd : > On Sat, Feb 08, 2003, David Schultz wrote: > > > Yes, the possibility of being bitten by compiler bugs is certainly > > higher with higher optimization levels. Alpha with -O2 seems to > > have been broken for years, and I have seen strange things happen > > on IA64 as well. But the i386 code generators have received much > > wider testing and debugging, so there is somewhat less danger there. > > Yet squid under i386 freebsd is .. well, finds -O bugs in gcc. > We gave up trying -O under FreeBSD a long time ago. :-) The last time someone told me, ``gcc -O is broken'', it turned out that they were doing some stack fiddling, and gcc's optimizations broke their faulty assumptions. On the other hand, I'm sure gcc -O does have bugs. Do you have an example snippet that gets miscompiled? > (note: I've seen better performance gains by telling gcc exactly what > CPU you have over -O65536 ..) Strangely, gcc in FreeBSD 5.0 actually generates *slower* code when compiling for more recent architectures than when compiling for a 386. I don't know whether that is a bug in gcc or whether gcc is using some fancy feature like SSE that the kernel handles poorly on context switches. I think there was some discussion on the lists about it earlier. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message