From owner-freebsd-current@FreeBSD.ORG Sun Dec 1 04:54:11 2013 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 86A5C89F for ; Sun, 1 Dec 2013 04:54:11 +0000 (UTC) Received: from mail-vc0-x236.google.com (mail-vc0-x236.google.com [IPv6:2607:f8b0:400c:c03::236]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 377DC1FA3 for ; Sun, 1 Dec 2013 04:54:11 +0000 (UTC) Received: by mail-vc0-f182.google.com with SMTP id lc6so7723030vcb.27 for ; Sat, 30 Nov 2013 20:54:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wemm.org; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=HfwaIs+SxgBIphMXfMN+kbZWvtFK83tovuEdj4f0Kz8=; b=RUoT7E/fvW/1ZMiKt6fQ/8bdOsKY8SxrMXEFtpQScrrKFFUnlKhB53ea7kKmjWzPEu fuwRLYWoijej/tRltnFHWsoWX6G1qtvf0EoiU9CDKgbnbXBaSS1IsPGA4NRKKJIGy6Cd CgM8Mz6su1oJ7JDC1iILYCb7ZKgbh+S36BS00= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=HfwaIs+SxgBIphMXfMN+kbZWvtFK83tovuEdj4f0Kz8=; b=b/7W3ekn/WqUPAr6DDAZgd+OrjvnADw9uyF51Qir92LPIGYa8lvzMRCERDSgFt+VwB +tkwnalrNNfNEsVtt2BMFbJ4ykiznd5EU1+RvyFOQmqGlzeW1rPBL06ZsexDYN4Slryf eB3w/J3l/qetURROv18XfrTXIxTeSmQhlOJ9SZF08p4fpq5yZ6ivkc3o10hiyLPz+Gt7 yjrVg5HBZJW9T0TIQODI4678Ez+3E8FR2k8q2waHI/wkwH3R1LX06vD08ou+LrLAB6p0 y5B+LkZBw9Tytw1QfxVBG50+bXB5hcQqENpLBNJJb42089a+49azUgWbGcK5iQzuQcR4 CIug== X-Gm-Message-State: ALoCoQk/S0oci7ym3r7S7EmkS5NsowvpBKosHicSnryIwnuOBf2Oe6YBx3jKReGCtPHPGQMraJVG MIME-Version: 1.0 X-Received: by 10.220.169.203 with SMTP id a11mr3003422vcz.26.1385873650192; Sat, 30 Nov 2013 20:54:10 -0800 (PST) Received: by 10.220.167.74 with HTTP; Sat, 30 Nov 2013 20:54:10 -0800 (PST) In-Reply-To: References: <20131130135616.GA59496@kib.kiev.ua> Date: Sat, 30 Nov 2013 20:54:10 -0800 Message-ID: Subject: Re: RFC: (Unconditionally) enable -fno-strict-overflow for kernel builds From: Peter Wemm To: Eitan Adler Content-Type: text/plain; charset=ISO-8859-1 Cc: Konstantin Belousov , Adrian Chadd , Dimitry Andric , "current@freebsd.org" X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Dec 2013 04:54:11 -0000 On Sat, Nov 30, 2013 at 8:38 PM, Eitan Adler wrote: > On Sat, Nov 30, 2013 at 11:26 PM, Peter Wemm wrote: >> On Sat, Nov 30, 2013 at 4:33 PM, Adrian Chadd wrote: >> [..] >>> Are you able to have clang/llvm/gcc tell us where/when code is relying >>> on undefined behaviour? So we can, like, fix them? >> >> It wasn't all that long ago that we had this wonderful thing called >> -Werror and had a clean kernel build. >> >> The problem is that gcc and clang have different warning sets. I seem >> to recall we had -Werror on for gcc and off for clang. IMHO it would >> be more useful to do it the other way around. > > Not all cases can be caught by static analysis. They would all be > caught be the integer sanitizer. However, these have not yet been > ported to FreeBSD. > I also missed the -Wno-error-tautological-compare setting. Oops. I personally tweak my builds a little so that: CC ../../../kern/kern_acct.c CC ../../../kern/kern_clock.c WARNING: kern_clock.c: enum pmc_event has too many values: 1669 > 1023 CC ../../../kern/kern_condvar.c CC ../../../kern/kern_conf.c CC ../../../kern/kern_cons.c CC ../../../kern/kern_cpu.c CC ../../../kern/kern_cpuset.c ../../../kern/kern_cpuset.c:637:16: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare] for (i = 0; i < (_NCPUWORDS - 1); i++) { ~ ^ ~~~~~~~~~~~~~~~~ 1 warning generated. CC ../../../kern/kern_context.c CC ../../../kern/kern_descrip.c CC ../../../kern/kern_dtrace.c Warnings stand out nicely that way. The diff is along these lines: --- kern.pre.mk (revision 258784) +++ kern.pre.mk (working copy) @@ -126,12 +126,12 @@ # Optional linting. This can be overridden in /etc/make.conf. LINTFLAGS= ${LINTOBJKERNFLAGS} -NORMAL_C= ${CC} -c ${CFLAGS} ${WERROR} ${PROF} ${.IMPSRC} -NORMAL_S= ${CC} -c ${ASM_CFLAGS} ${WERROR} ${.IMPSRC} +NORMAL_C= @echo " CC ${.IMPSRC}" ; ${CC} -c ${CFLAGS} ${WERROR} ${PROF} ${.IMPSRC} +NORMAL_S= @echo " AS ${.IMPSRC}" ; ${CC} -c ${ASM_CFLAGS} ${WERROR} ${.IMPSRC} PROFILE_C= ${CC} -c ${CFLAGS} ${WERROR} ${.IMPSRC} -NORMAL_C_NOWERROR= ${CC} -c ${CFLAGS} ${PROF} ${.IMPSRC} +NORMAL_C_NOWERROR= @echo " CC_NOWERROR ${.IMPSRC}" ; ${CC} -c ${CFLAGS} ${PROF} ${.IMPSRC} ... Unfortunately that interferes with my usual use of 'make -s' - silent. -- Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com; KI6FJV UTF-8: for when a ' just won\342\200\231t do.