From: Ian Lance Taylor Date: Wed, 1 Sep 2010 20:40:20 +0000 (-0700) Subject: test: Use global variables to defeat gccgo optimizer. X-Git-Tag: weekly.2010-09-06~30 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=426275d70236be0ac817ae8185c215e9fc4eb681;p=gostls13.git test: Use global variables to defeat gccgo optimizer. The gccgo compiler is smart enough to not make something which is not used. Use global variables to defeat this optimization. R=rsc CC=golang-dev https://golang.org/cl/2129041 --- diff --git a/test/fixedbugs/bug273.go b/test/fixedbugs/bug273.go index ff8f1c6af3..816f69e8f1 100644 --- a/test/fixedbugs/bug273.go +++ b/test/fixedbugs/bug273.go @@ -15,6 +15,8 @@ var bug = false var minus1 = -1 var big int64 = 10 | 1<<32 +var g1 []int + func shouldfail(f func(), desc string) { defer func() { recover() }() f() @@ -26,52 +28,56 @@ func shouldfail(f func(), desc string) { } func badlen() { - _ = make([]int, minus1) + g1 = make([]int, minus1) } func biglen() { - _ = make([]int, big) + g1 = make([]int, big) } func badcap() { - _ = make([]int, 10, minus1) + g1 = make([]int, 10, minus1) } func badcap1() { - _ = make([]int, 10, 5) + g1 = make([]int, 10, 5) } func bigcap() { - _ = make([]int, 10, big) + g1 = make([]int, 10, big) } const ( addrBits = 8*uint(unsafe.Sizeof((*byte)(nil))) sh = addrBits/2 - 2 ) +var g2 [][1<