"cmd/internal/objabi"
"cmd/internal/src"
"fmt"
+ "hash/crc32"
"log"
+ "math/rand"
"os"
"regexp"
"runtime"
f.Logf("compiling %s\n", f.Name)
}
+ var rnd *rand.Rand
+ if checkEnabled {
+ rnd = rand.New(rand.NewSource(int64(crc32.ChecksumIEEE(([]byte)(f.Name)))))
+ }
+
// hook to print function & phase if panic happens
phaseName := "init"
defer func() {
runtime.ReadMemStats(&mStart)
}
+ if checkEnabled && !f.scheduled {
+ // Test that we don't depend on the value order, by randomizing
+ // the order of values in each block. See issue 18169.
+ for _, b := range f.Blocks {
+ for i := 0; i < len(b.Values)-1; i++ {
+ j := i + rnd.Intn(len(b.Values)-i)
+ b.Values[i], b.Values[j] = b.Values[j], b.Values[i]
+ }
+ }
+ }
+
tStart := time.Now()
p.fn(f)
tEnd := time.Now()
b.Values = b.Values[:i]
// TODO: if b.Kind == BlockPlain, start the analysis in the subsequent block to find
- // more unnecessary nil checks. Would fix test/nilptr3_ssa.go:157.
+ // more unnecessary nil checks. Would fix test/nilptr3.go:159.
}
}
}
args = args[1:]
}
+ if action == "errorcheck" {
+ found := false
+ for i, f := range flags {
+ if strings.HasPrefix(f, "-d=") {
+ flags[i] = f + ",ssa/check/on"
+ found = true
+ break
+ }
+ }
+ if !found {
+ flags = append(flags, "-d=ssa/check/on")
+ }
+ }
t.makeTempDir()
if !*keep {