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" && \ _______________________________________________ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"