From owner-freebsd-hackers@freebsd.org Sun Jan 3 18:11:49 2016 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9CF80A606D7 for ; Sun, 3 Jan 2016 18:11:49 +0000 (UTC) (envelope-from joerg@britannica.bec.de) Received: from mo6-p00-ob.smtp.rzone.de (mo6-p00-ob.smtp.rzone.de [IPv6:2a01:238:20a:202:5300::9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.smtp.rzone.de", Issuer "TeleSec ServerPass DE-2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4187C1A7C for ; Sun, 3 Jan 2016 18:11:48 +0000 (UTC) (envelope-from joerg@britannica.bec.de) X-RZG-AUTH: :JiIXek6mfvEEUpFQdo7Fj1/zg48CFjWjQuEfXeSt/nWoxNEod/GGOF9MfA4zuWcD X-RZG-CLASS-ID: mo00 Received: from britannica.bec.de ([37.203.150.109]) by smtp.strato.de (RZmta 37.15 AUTH) with ESMTPSA id V071d8s03IBjcAT (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate) for ; Sun, 3 Jan 2016 19:11:45 +0100 (CET) Date: Sun, 3 Jan 2016 19:11:39 +0100 From: Joerg Sonnenberger To: freebsd-hackers@freebsd.org Subject: Re: variables optimized out Message-ID: <20160103181139.GA16659@britannica.bec.de> Mail-Followup-To: freebsd-hackers@freebsd.org References: <20160103145923.GA16970@becker.bs.l> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20160103145923.GA16970@becker.bs.l> User-Agent: Mutt/1.5.24 (2015-08-30) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Jan 2016 18:11:49 -0000 On Sun, Jan 03, 2016 at 03:59:23PM +0100, Bertram Scharpf wrote: > Hi, > > On Sunday, 03. Jan 2016, 14:38:33 +0100, robbinson defau wrote: > > Im debugging some issues in the kernel and as the kernel is compiled by > > default with -O2, a lot of variables are optimized out. So i made changes > > to make.conf (CFLAGS and COPTFLAGS).\ > > > > All builds fine, but I get the weirdest of panics that most certainly not > > happen with -O2. [...] > > I just had a look at "man make.conf" and that says: > > CFLAGS (str) Controls the compiler setting when compiling C code. > Optimization levels other than -O and -O2 are not sup‐ > ported. > > At least to me this is a surprise. I'm really disappointed > about what programming style has become common. There are two strong historical reasons from GCC behavior: - a lot of the -O3 optimisations has been known to break questionable code - a lot of the warnings significantly change behavior depending on the optmizer. While the former is not a big problem for disabling optimisation, the latter certainly is. Note that with clang there is no difference between -O and -O2. Joerg