aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/typecheck/iimport.go
diff options
context:
space:
mode:
authorKeith Randall <khr@golang.org>2021-03-05 09:49:28 -0800
committerKeith Randall <khr@golang.org>2021-03-09 17:51:10 +0000
commitb60a3a8cfbc6096babe72ebcee0733bba496cf9a (patch)
tree8918e38b1c3e9e98a57988bd677f904a7e44700d /src/cmd/compile/internal/typecheck/iimport.go
parenta70eb2c9f2e3d52116b90a21ce10718356197ee5 (diff)
downloadgo-b60a3a8cfbc6096babe72ebcee0733bba496cf9a.tar.gz
go-b60a3a8cfbc6096babe72ebcee0733bba496cf9a.zip
cmd/compile: add debugging mode for import/export
Just add a simple magic number with each op, to detect when the reader gets desynchronized from the writer. Change-Id: Iac7dab7f465b0021b1d7ae31c8f8a353ac3663a2 Reviewed-on: https://go-review.googlesource.com/c/go/+/299769 Trust: Keith Randall <khr@golang.org> Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Dan Scales <danscales@google.com>
Diffstat (limited to 'src/cmd/compile/internal/typecheck/iimport.go')
-rw-r--r--src/cmd/compile/internal/typecheck/iimport.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/typecheck/iimport.go b/src/cmd/compile/internal/typecheck/iimport.go
index 8df75b2285..d7c118b631 100644
--- a/src/cmd/compile/internal/typecheck/iimport.go
+++ b/src/cmd/compile/internal/typecheck/iimport.go
@@ -1228,6 +1228,9 @@ func (r *importReader) node() ir.Node {
}
func (r *importReader) op() ir.Op {
+ if debug && r.uint64() != magic {
+ base.Fatalf("import stream has desynchronized")
+ }
return ir.Op(r.uint64())
}