Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 Mar 2015 14:37:28 -0700
From:      Garrett Cooper <yaneurabeya@gmail.com>
To:        Dimitry Andric <dim@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:  <3E288A39-D7DB-458A-B425-8B449DD57E35@gmail.com>
In-Reply-To: <864EB4DB-2DF7-4294-9498-95E54E6B49CC@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> <494AEF4B-0AF8-449A-9B41-9AC4F4552AF0@FreeBSD.org> <CAG=rPVchdm_VaTshq%2BRN%2BkHX0YC0_Tsx22oJVNNnoOamdm00mQ@mail.gmail.com> <864EB4DB-2DF7-4294-9498-95E54E6B49CC@FreeBSD.org>

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

--Apple-Mail=_304F0F11-EC28-4252-9E60-0A9BD13758EF
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=windows-1252

On Mar 22, 2015, at 14:36, Dimitry Andric <dim@FreeBSD.org> wrote:

> On 22 Mar 2015, at 22:32, Craig Rodrigues <rodrigc@FreeBSD.org> wrote:
>>=20
>> On Sun, Mar 22, 2015 at 2:29 PM, Dimitry Andric <dim@freebsd.org> =
wrote:
>>=20
>> Ah right, that was on i386, on amd64 it does result in -2^63.  It is =
indeed caused by reliance on signed integer wrapping.
>>=20
>> This diff should fix it, without rewriting the utility:
>>=20
>> 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
>>=20
>> +# expr relies on signed integer wrapping
>> +CFLAGS+=3D -fwrapv
>> +
>> NO_WMISSING_VARIABLE_DECLARATIONS=3D
>>=20
>> .if ${MK_TESTS} !=3D "no"
>>=20
>>=20
>> Well, another alternative is to patch expr.y:
>>=20
>> Index: expr.y
>> =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
>> --- expr.y      (revision 280353)
>> +++ expr.y      (working copy)
>> @@ -393,7 +393,7 @@
>> }
>>=20
>> void
>> -assert_plus(intmax_t a, intmax_t b, intmax_t r)
>> +assert_plus(intmax_t a, intmax_t b, volatile intmax_t r)
>> {
>>        /*
>>         * sum of two positive numbers must be positive,
>> @@ -420,7 +420,7 @@
>> }
>>=20
>> void
>> -assert_minus(intmax_t a, intmax_t b, intmax_t r)
>> +assert_minus(intmax_t a, intmax_t b, volatile intmax_t r)
>> {
>>        /* special case subtraction of INTMAX_MIN */
>>        if (b =3D=3D INTMAX_MIN && a < 0)
>>=20
>>=20
>> There were already some patches previously done to this
>> file to add "volatile", so maybe this would be OK to do.
>>=20
>> What do you think?
>=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.

Before doing that =97 what changed in the past week that changed the =
behavior of expr?
Thanks!

--Apple-Mail=_304F0F11-EC28-4252-9E60-0A9BD13758EF
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-----
Comment: GPGTools - https://gpgtools.org

iQEcBAEBCgAGBQJVDzYYAAoJEMZr5QU6S73eHW0H/RWRCspXwSZo7vbqsy6iRuOU
3Sr+rFduyTFuY1/TTnbLZYEUG/RmzS0hHDzw78r9XGh/5omjsiVXCIbV0GPIP07r
Xy3T2qAuSdTi140mwcJMDCXpQQPXhtrIw4y1ZkrMJEe1+fVuOldRAPJJfiI5hJMC
SnKLvAxhQ/KdQVTkB/DUN9XvZ2TeWRlinChGNA4Ca+5UoPZlHYI+cQWcybsSyQEA
Z3Fho4XY3Tt8O6SUKramxaE638WgTD+0TWTxcz2kCo+hSdJnZ0T5cF9xQNb6DwR0
XzMoWsnOJVRgB7N3TDb5FhdBgJLYX8rwkwL0/ByAmoyc9r8oGlMlT8XtF/gxHNw=
=DmrI
-----END PGP SIGNATURE-----

--Apple-Mail=_304F0F11-EC28-4252-9E60-0A9BD13758EF--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3E288A39-D7DB-458A-B425-8B449DD57E35>