Jenkins build is still unstable: FreeBSD_HEAD-tests2 #867

David Chisnall theraven at
Mon Mar 23 09:39:30 UTC 2015

On 22 Mar 2015, at 22:01, Craig Rodrigues <rodrigc at> wrote:
>> 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.
> 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"); 
	mul = a->u.i * b->u.i;
	r = 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.  


More information about the freebsd-current mailing list