From: Russ Cox Date: Thu, 30 Oct 2008 02:34:47 +0000 (-0700) Subject: bugs from old gri mail X-Git-Tag: weekly.2009-11-06~2854 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=cf9e46fec6e0e4a6a355dc41aa00d6a2430444da;p=gostls13.git bugs from old gri mail R=gri OCL=18093 CL=18093 --- diff --git a/test/bugs/bug115.go b/test/bugs/bug115.go new file mode 100644 index 0000000000..16b22d7079 --- /dev/null +++ b/test/bugs/bug115.go @@ -0,0 +1,14 @@ +// $G $D/$F.go || echo BUG: bug115 should compile + +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package main + +func isuint(i uint) { } + +func main() { + i := ^uint(0); + isuint(i); +} diff --git a/test/bugs/bug116.go b/test/bugs/bug116.go new file mode 100644 index 0000000000..32c99d46eb --- /dev/null +++ b/test/bugs/bug116.go @@ -0,0 +1,34 @@ +// $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG: bug116 + +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package main + +func main() { + bad := false; + if (-5>>1) != -3 { + println("-5>>1 =", -5>>1, "want -3"); + bad = true; + } + if (-4>>1) != -2 { + println("-4>>1 =", -4>>1, "want -2"); + bad = true; + } + if (-3>>1) != -2 { + println("-3>>1 =", -3>>1, "want -2"); + bad = true; + } + if (-2>>1) != -1 { + println("-2>>1 =", -2>>1, "want -1"); + bad = true; + } + if (-1>>1) != -1 { + println("-1>>1 =", -1>>1, "want -1"); + bad = true; + } + if bad { + panicln("errors"); + } +} diff --git a/test/golden.out b/test/golden.out index b144e0d2fd..219d2c4b5a 100644 --- a/test/golden.out +++ b/test/golden.out @@ -264,3 +264,19 @@ M =========== fixedbugs/bug103.go fixedbugs/bug103.go:8: function requires a return type + +=========== bugs/bug115.go +bugs/bug115.go:8: overflow converting constant to uint +BUG: bug115 should compile + +=========== bugs/bug116.go +-5>>1 = -2 want -3 +-4>>1 = -3 want -2 +-3>>1 = -1 want -2 +-2>>1 = -2 want -1 +-1>>1 = 0 want -1 +errors + +panic on line 92 PC=xxx +BUG: bug116 +