From d75dae75d741eb852f400ccda88079bc3f26a3ad Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 6 Jul 2011 18:38:24 +0000 Subject: [PATCH] json: fix test when rand returns 0. Fixes using gccgo when optimizing, which changes the order of calls to rand. Same patch proposed upstream. From-SVN: r175927 --- libgo/go/json/scanner_test.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libgo/go/json/scanner_test.go b/libgo/go/json/scanner_test.go index 0d4de3246dd..df87c716aff 100644 --- a/libgo/go/json/scanner_test.go +++ b/libgo/go/json/scanner_test.go @@ -252,6 +252,9 @@ func genArray(n int) []interface{} { if f > n { f = n } + if n > 0 && f == 0 { + f = 1 + } x := make([]interface{}, int(f)) for i := range x { x[i] = genValue(((i+1)*n)/f - (i*n)/f)