From owner-svn-src-head@FreeBSD.ORG Thu Feb 5 01:36:54 2015 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2DD0F42A; Thu, 5 Feb 2015 01:36:54 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 19FA3A7C; Thu, 5 Feb 2015 01:36:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t151arEB088864; Thu, 5 Feb 2015 01:36:53 GMT (envelope-from peter@FreeBSD.org) Received: (from peter@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t151arDn088863; Thu, 5 Feb 2015 01:36:53 GMT (envelope-from peter@FreeBSD.org) Message-Id: <201502050136.t151arDn088863@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: peter set sender to peter@FreeBSD.org using -f From: Peter Wemm Date: Thu, 5 Feb 2015 01:36:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r278229 - head/sys/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Feb 2015 01:36:54 -0000 Author: peter Date: Thu Feb 5 01:36:53 2015 New Revision: 278229 URL: https://svnweb.freebsd.org/changeset/base/278229 Log: Add -fwrapv to CFLAGS for the kernel. This essentially un-reverts r259045. The C standard undefines behavior when signed integers overflow. The compiler toolchain has become more adept at detecting this and taking advantage of faster undefined behavior. At the current time this has the unfortunate effect of the clock stopping after 24 days of uptime. clang makes no distinction between -fwrapv and -fno-strict-overflow. gcc does treat them differently but -fwrapv is mature in gcc and is the behavior are actually expecting. Obtained from: kib Modified: head/sys/conf/kern.mk Modified: head/sys/conf/kern.mk ============================================================================== --- head/sys/conf/kern.mk Thu Feb 5 00:12:21 2015 (r278228) +++ head/sys/conf/kern.mk Thu Feb 5 01:36:53 2015 (r278229) @@ -158,6 +158,14 @@ INLINE_LIMIT?= 8000 CFLAGS+= -ffreestanding # +# The C standard leaves signed integer overflow behavior undefined. +# gcc and clang opimizers take advantage of this. The kernel makes +# use of signed integer wraparound mechanics so we need the compiler +# to treat it as a wraparound and not take shortcuts. +# +CFLAGS+= -fwrapv + +# # GCC SSP support # .if ${MK_SSP} != "no" && \