Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 Mar 2015 22:29:43 +0100
From:      Dimitry Andric <dim@FreeBSD.org>
To:        Craig Rodrigues <rodrigc@FreeBSD.org>
Cc:        "freebsd-testing@freebsd.org" <freebsd-testing@freebsd.org>, freebsd-current Current <freebsd-current@freebsd.org>, "jenkins-admin@freebsd.org" <jenkins-admin@freebsd.org>, freebsd-toolchain@freebsd.org
Subject:   Re: Jenkins build is still unstable: FreeBSD_HEAD-tests2 #867
Message-ID:  <494AEF4B-0AF8-449A-9B41-9AC4F4552AF0@FreeBSD.org>
In-Reply-To: <BE5A3694-E1D1-4A47-8707-D6214E997363@FreeBSD.org>
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>

next in thread | previous in thread | raw e-mail | index | archive | help

--Apple-Mail=_1B247339-B440-44BF-81CB-2C53DA7C0EB4
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=us-ascii

On 22 Mar 2015, at 22:23, Dimitry Andric <dim@FreeBSD.org> wrote:
>=20
> On 22 Mar 2015, at 22:02, Craig Rodrigues <rodrigc@FreeBSD.org> wrote:
>>=20
>> On Sun, Mar 22, 2015 at 11:26 AM, <jenkins-admin@freebsd.org> wrote:
>>=20
>>> See <https://jenkins.freebsd.org/job/FreeBSD_HEAD-tests2/867/>;
>>>=20
>>=20
>> Can someone with toolchain expertise look at this?
>> After the clang 3.6.1 import, /bin/expr behaves differently.
>>=20
>> With clang 3.5.0:
>>=20
>> # expr 4611686018427387904 + 4611686018427387904
>> expr: overflow
>>=20
>> With clang 3.6.1:
>>=20
>> # expr 4611686018427387904 + 4611686018427387904
>> -9223372036854775808
>=20
> It works fine for me:
>=20
> $ /usr/obj/usr/src/bin/expr/expr 4611686018427387904 + =
4611686018427387904
> expr: overflow

Ah right, that was on i386, on amd64 it does result in -2^63.  It is =
indeed caused by reliance on signed integer wrapping.

This diff should fix it, without rewriting the utility:

Index: bin/expr/Makefile
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- bin/expr/Makefile	(revision 280156)
+++ bin/expr/Makefile	(working copy)
@@ -6,6 +6,9 @@ PROG=3D	expr
 SRCS=3D	expr.y
 YFLAGS=3D

+# expr relies on signed integer wrapping
+CFLAGS+=3D -fwrapv
+
 NO_WMISSING_VARIABLE_DECLARATIONS=3D

 .if ${MK_TESTS} !=3D "no"

-Dimitry


--Apple-Mail=_1B247339-B440-44BF-81CB-2C53DA7C0EB4
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename=signature.asc
Content-Type: application/pgp-signature;
	name=signature.asc
Content-Description: Message signed with OpenPGP using GPGMail

-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.27

iEYEARECAAYFAlUPNEcACgkQsF6jCi4glqP5HwCeKYgKWHDn47Xr4qJQROpKmJo5
jxYAoO+QWs7JjiiTgzGMaXmRrepUcuHD
=pRHL
-----END PGP SIGNATURE-----

--Apple-Mail=_1B247339-B440-44BF-81CB-2C53DA7C0EB4--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?494AEF4B-0AF8-449A-9B41-9AC4F4552AF0>