From owner-freebsd-current@FreeBSD.ORG Thu Feb 5 09:29:31 2015 Return-Path: Delivered-To: freebsd-current@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 8DFD91B0 for ; Thu, 5 Feb 2015 09:29:31 +0000 (UTC) Received: from theravensnest.org (theraven.freebsd.your.org [216.14.102.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cloud.theravensnest.org", Issuer "StartCom Class 1 Primary Intermediate Server CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 53309C23 for ; Thu, 5 Feb 2015 09:29:30 +0000 (UTC) Received: from [192.168.0.7] (cpc16-cmbg15-2-0-cust60.5-4.cable.virginm.net [86.5.162.61]) (authenticated bits=0) by theravensnest.org (8.15.1/8.14.9) with ESMTPSA id t159T4GN062227 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 5 Feb 2015 09:29:18 GMT (envelope-from theraven@FreeBSD.org) X-Authentication-Warning: theravensnest.org: Host cpc16-cmbg15-2-0-cust60.5-4.cable.virginm.net [86.5.162.61] claimed to be [192.168.0.7] Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2070.6\)) Subject: Re: PSA: If you run -current, beware! From: David Chisnall In-Reply-To: Date: Thu, 5 Feb 2015 09:29:01 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: References: <8089702.oYScRm8BTN@overcee.wemm.org> <20150204142941.GE42409@kib.kiev.ua> <2509923.ondFvsFdql@overcee.wemm.org> To: Luigi Rizzo X-Mailer: Apple Mail (2.2070.6) Cc: Konstantin Belousov , "freebsd-current@freebsd.org" , Peter Wemm X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.18-1 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: Thu, 05 Feb 2015 09:29:31 -0000 On 5 Feb 2015, at 07:48, Luigi Rizzo wrote: >=20 > Rather than depending on a compiler option, wouldn't it be better/more > robust to change ticks to unsigned, which has specified wrapping = behavior? Especially if we want to extend support for external toolchains. gcc = and clang support -fwrapv (though occasionally versions of both will not = fully support it), but other compilers may well not have an equivalent. Translating the code into C is a far more robust solution than the = band-aid of telling the compiler to accept a language that is a bit like = C and hoping that this will keep working across compiler implementations = and versions. Adding -fwrapv also defeats a number of compiler optimisations, so we = are going to generate worse code for places where people used signed = types correctly to work around places where they were used incorrectly. David