From owner-freebsd-hackers@FreeBSD.ORG Sat Dec 23 08:17:05 2006 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8824A16A5D4 for ; Sat, 23 Dec 2006 08:17:05 +0000 (UTC) (envelope-from jdamato@andrew.cmu.edu) Received: from smtp.andrew.cmu.edu (smtp.andrew.cmu.edu [128.2.10.81]) by mx1.freebsd.org (Postfix) with ESMTP id 5032113C43A for ; Sat, 23 Dec 2006 08:17:05 +0000 (UTC) (envelope-from jdamato@andrew.cmu.edu) Received: from webmail.andrew.cmu.edu (WEBMAIL2.andrew.cmu.edu [128.2.10.189]) (user=jdamato mech=GSSAPI (56 bits)) by smtp.andrew.cmu.edu (8.13.6/8.13.6) with ESMTP id kBN7cHdj021566; Sat, 23 Dec 2006 02:38:17 -0500 Received: from 69.125.236.143 (SquirrelMail authenticated user jdamato@ANDREW.CMU.EDU); by webmail.andrew.cmu.edu with HTTP; Sat, 23 Dec 2006 02:38:15 -0500 (EST) Message-ID: <2288.69.125.236.143.1166859495.squirrel@69.125.236.143> In-Reply-To: <458C7DC4.1080304@geminix.org> References: <200612220850.kBM8oDD0037287@lurza.secnetix.de> <458C1BCB.6040907@u.washington.edu> <458C7DC4.1080304@geminix.org> Date: Sat, 23 Dec 2006 02:38:15 -0500 (EST) From: "Joseph J. Damato" To: "Uwe Doering" User-Agent: SquirrelMail/1.5.1 [CVS] MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal X-Scanned-By: MIMEDefang 2.57 on 128.2.10.81 Cc: freebsd-hackers@freebsd.org, Garrett Cooper Subject: Re: Properly controlling CFLAGS/CXXFLAGS X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Dec 2006 08:17:05 -0000 > Garrett Cooper wrote: > > With '-O2' and better, '-fstrict-aliasing' is the default in newer > versions of GCC, AFAIK, but people tend to switch it off because it > apparently breaks too many software packages. Or at least those whose > code base dates back to times where '-fno-strict-aliasing' was the default > and people got away with certain nasty coding hacks that no longer work > with '-fstrict-aliasing'. > Well, -fno-strict-aliasing is pretty useful, especially if you want to do things with floating point. Not all code which requires -fno-strict-aliasing has "nasty coding hacks." As GCC says, the results are undefined when the flag is not passed. I have personally seen code that "looks" right but which results in very odd behavior with -O2, but works fine with any other optimization level. In situations like this, the flag is useful. Joe Damato