Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Mar 2015 09:33:15 +0000
From:      David Chisnall <theraven@FreeBSD.org>
To:        Craig Rodrigues <rodrigc@FreeBSD.org>
Cc:        "freebsd-testing@freebsd.org" <freebsd-testing@freebsd.org>, "jenkins-admin@freebsd.org" <jenkins-admin@freebsd.org>, freebsd-current Current <freebsd-current@freebsd.org>, Dimitry Andric <dim@freebsd.org>, freebsd-toolchain@freebsd.org
Subject:   Re: Jenkins build is still unstable: FreeBSD_HEAD-tests2 #867
Message-ID:  <C8D88048-8CC6-40B8-A778-A33287CA2897@FreeBSD.org>
In-Reply-To: <CAG=rPVdP_TAmerKh_82EravEw=sCj4LyEBu-NfGCK0Obg=HMVw@mail.gmail.com>
References:  <1669399171.13.1427029129760.JavaMail.jenkins@jenkins-9.freebsd.org> <799490341.14.1427048792932.JavaMail.jenkins@jenkins-9.freebsd.org> <CAG=rPVeyamLPnC5i05_=Ub0D%2BV256U_8t8R5tfDitC=NkjBOFQ@mail.gmail.com> <BE5A3694-E1D1-4A47-8707-D6214E997363@FreeBSD.org> <494AEF4B-0AF8-449A-9B41-9AC4F4552AF0@FreeBSD.org> <CAG=rPVchdm_VaTshq%2BRN%2BkHX0YC0_Tsx22oJVNNnoOamdm00mQ@mail.gmail.com> <864EB4DB-2DF7-4294-9498-95E54E6B49CC@FreeBSD.org> <CAG=rPVdP_TAmerKh_82EravEw=sCj4LyEBu-NfGCK0Obg=HMVw@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 22 Mar 2015, at 22:01, Craig Rodrigues <rodrigc@FreeBSD.org> wrote:
>=20
>> Volatile is not the solution, it is completely orthogonal.  The =
correct
>> way would be to use unsigned integers, for which wrapping is defined,
>> then convert those back and forth when presenting the results to the
>> user.
>>=20
>=20
> OK, converting expr.y to use unsigned integers would require a bit of =
work.

Note that clang has, for a few releases, had builtins that allow =
overflow-checked operations and will generate very efficient code.  In =
op_times, I believe the following should work:

	long long mul;
#if __has_builtin(__builtin_smulll_overflow)
	if (__builtin_smulll_overflow(a->u.i, b->u.i, &mul))
		errx(ERR_EXIT, "overflow");=20
#else
	mul =3D a->u.i * b->u.i;
#endif
	r =3D make_integer(mul);

I don't know if recent versions of gcc implement these builtins yet.  I =
think they were added to clang around 3.4, possibly slightly earlier. =20=


David




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?C8D88048-8CC6-40B8-A778-A33287CA2897>