Skip to content
Snippets Groups Projects
Commit d75dae75 authored by Ian Lance Taylor's avatar Ian Lance Taylor
Browse files

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
parent 60b45394
No related branches found
No related tags found
No related merge requests found
...@@ -252,6 +252,9 @@ func genArray(n int) []interface{} { ...@@ -252,6 +252,9 @@ func genArray(n int) []interface{} {
if f > n { if f > n {
f = n f = n
} }
if n > 0 && f == 0 {
f = 1
}
x := make([]interface{}, int(f)) x := make([]interface{}, int(f))
for i := range x { for i := range x {
x[i] = genValue(((i+1)*n)/f - (i*n)/f) x[i] = genValue(((i+1)*n)/f - (i*n)/f)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment