aboutsummaryrefslogtreecommitdiff
path: root/test/zerodivide.go
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2010-09-11 22:51:05 -0700
committerIan Lance Taylor <iant@golang.org>2010-09-11 22:51:05 -0700
commit8d4059f9b38736efaa413f876e8666e82e7d3940 (patch)
tree1f87e95f26cbe29a4cbc80cf2d537a4c805972d8 /test/zerodivide.go
parentf47d403cb48f669fe4a6c4ba6bcaaa33eb2e51af (diff)
downloadgo-8d4059f9b38736efaa413f876e8666e82e7d3940.tar.gz
go-8d4059f9b38736efaa413f876e8666e82e7d3940.zip
test: Make gccgo believe that the variables can change.
This test is supposed to test runtime behaviour. However, gccgo is smart enough to see that the variables are local to the package and that they never change. Add a function so that gccgo thinks that the variables can in fact vary, so that the test works at runtime as expected. R=rsc CC=golang-dev https://golang.org/cl/2178041
Diffstat (limited to 'test/zerodivide.go')
-rw-r--r--test/zerodivide.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/zerodivide.go b/test/zerodivide.go
index 224797fcd9..5fe1eb00d3 100644
--- a/test/zerodivide.go
+++ b/test/zerodivide.go
@@ -46,6 +46,30 @@ var (
c128, d128, e128 complex128 = 0+0i, 0+0i, 1+1i
)
+// Fool gccgo into thinking that these variables can change.
+func NotCalled() {
+ i++; j++; k++
+ i8++; j8++; k8++
+ i16++; j16++; k16++
+ i32++; j32++; k32++
+ i64++; j64++; k64++
+
+ u++; v++; w++
+ u8++; v8++; w8++
+ u16++; v16++; w16++
+ u32++; v32++; w32++
+ u64++; v64++; w64++
+ up++; vp++; wp++
+
+ f += 1; g += 1; h += 1
+ f32 += 1; g32 += 1; h32 += 1
+ f64 += 1; g64 += 1; h64 += 1
+
+ c += 1+1i; d += 1+1i; e += 1+1i
+ c64 += 1+1i; d64 += 1+1i; e64 += 1+1i
+ c128 += 1+1i; d128 += 1+1i; e128 += 1+1i
+}
+
var tmp interface{}
// We could assign to _ but the compiler optimizes it too easily.