From 6a2e844f5179e85085723be29c9ba97f1286b698 Mon Sep 17 00:00:00 2001 From: Dave Cheney Date: Mon, 8 Sep 2014 15:36:21 +1000 Subject: [PATCH] cmd/gc: fix undefined behaviour warning in subr.c Fixes warning /home/dfc/go/src/cmd/gc/subr.c:3469:8: runtime error: negation of -9223372036854775808 cannot be represented in type 'int64' (aka 'long'); cast to an unsigned type to negate this value to itself LGTM=rsc R=rsc CC=golang-codereviews https://golang.org/cl/141220043 --- src/cmd/gc/subr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cmd/gc/subr.c b/src/cmd/gc/subr.c index 93600c688b..666be96679 100644 --- a/src/cmd/gc/subr.c +++ b/src/cmd/gc/subr.c @@ -3466,7 +3466,7 @@ smagic(Magic *m) p = m->w-1; ad = m->sd; if(m->sd < 0) - ad = -m->sd; + ad = -(uvlong)m->sd; // bad denominators if(ad == 0 || ad == 1 || ad == two31) {