diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2011-07-06 18:38:24 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2011-07-06 18:38:24 +0000 |
commit | d75dae75d741eb852f400ccda88079bc3f26a3ad (patch) | |
tree | 19cfda924d3515d74553153864902b4c267e10bd | |
parent | 60b45394386c7b833c9b95f7f034532a1411cfc7 (diff) | |
download | gcc-d75dae75d741eb852f400ccda88079bc3f26a3ad.zip gcc-d75dae75d741eb852f400ccda88079bc3f26a3ad.tar.gz gcc-d75dae75d741eb852f400ccda88079bc3f26a3ad.tar.bz2 |
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
-rw-r--r-- | libgo/go/json/scanner_test.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/libgo/go/json/scanner_test.go b/libgo/go/json/scanner_test.go index 0d4de32..df87c71 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) |