cmd/compile: add compiler debug flag to disable range func iterator checking

E.g.
`GOEXPERIMENT=rangefunc go test -v -gcflags=-d=rangefunccheck=0 rangefunc_test.go`
will turn off the checking and fail.

The benchmarks, which do not use pathological iterators, run slightly faster.

Change-Id: Ia3e175e86d67ef74bbae9bcc5d2def6a2cdf519d
Reviewed-on: https://go-review.googlesource.com/c/go/+/541995
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
David Chase 2023-11-11 15:32:45 -05:00
parent d6ef98b8fa
commit d411b3197c
3 changed files with 40 additions and 11 deletions

View file

@ -182,6 +182,7 @@ func ParseFlags() {
Debug.PGODevirtualize = 1
Debug.SyncFrames = -1 // disable sync markers by default
Debug.ZeroCopy = 1
Debug.RangeFuncCheck = 1
Debug.Checkptr = -1 // so we can tell whether it is set explicitly