diff --git a/src/cmd/compile/internal/gc/pgen.go b/src/cmd/compile/internal/gc/pgen.go index fdf3bf7847..355df9d326 100644 --- a/src/cmd/compile/internal/gc/pgen.go +++ b/src/cmd/compile/internal/gc/pgen.go @@ -16,6 +16,7 @@ import ( "math/rand" "sort" "sync" + "time" ) // "Portable" code generation. @@ -249,6 +250,12 @@ func compileSSA(fn *Node, worker int) { pp.Free() } +func init() { + if raceEnabled { + rand.Seed(time.Now().UnixNano()) + } +} + // compileFunctions compiles all functions in compilequeue. // It fans out nBackendWorkers to do the work // and waits for them to complete.