Jenkins build is still unstable: FreeBSD_HEAD-tests2 #867

Dimitry Andric dim at FreeBSD.org
Sun Mar 22 21:29:47 UTC 2015


On 22 Mar 2015, at 22:23, Dimitry Andric <dim at FreeBSD.org> wrote:
> 
> On 22 Mar 2015, at 22:02, Craig Rodrigues <rodrigc at FreeBSD.org> wrote:
>> 
>> On Sun, Mar 22, 2015 at 11:26 AM, <jenkins-admin at freebsd.org> wrote:
>> 
>>> See <https://jenkins.freebsd.org/job/FreeBSD_HEAD-tests2/867/>
>>> 
>> 
>> Can someone with toolchain expertise look at this?
>> After the clang 3.6.1 import, /bin/expr behaves differently.
>> 
>> With clang 3.5.0:
>> 
>> # expr 4611686018427387904 + 4611686018427387904
>> expr: overflow
>> 
>> With clang 3.6.1:
>> 
>> # expr 4611686018427387904 + 4611686018427387904
>> -9223372036854775808
> 
> It works fine for me:
> 
> $ /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
===================================================================
--- bin/expr/Makefile	(revision 280156)
+++ bin/expr/Makefile	(working copy)
@@ -6,6 +6,9 @@ PROG=	expr
 SRCS=	expr.y
 YFLAGS=

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

 .if ${MK_TESTS} != "no"

-Dimitry

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 194 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.freebsd.org/pipermail/freebsd-current/attachments/20150322/e68a6beb/attachment.sig>


More information about the freebsd-current mailing list