From: Russ Cox Date: Wed, 29 Jul 2015 23:04:35 +0000 (-0400) Subject: runtime: set invalidptr=1 by default, as documented X-Git-Tag: go1.5beta3 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=d3ffc975f38890abbd8ca3f7833772e6423297e8;p=gostls13.git runtime: set invalidptr=1 by default, as documented Also make invalidptr control the recently added GC pointer check, as documented. Change-Id: Iccfdf49480219d12be8b33b8f03d8312d8ceabed Reviewed-on: https://go-review.googlesource.com/12857 Run-TryBot: Russ Cox Reviewed-by: Rob Pike --- diff --git a/src/runtime/mbitmap.go b/src/runtime/mbitmap.go index b9b52a7bc4..c439158f07 100644 --- a/src/runtime/mbitmap.go +++ b/src/runtime/mbitmap.go @@ -201,7 +201,7 @@ func heapBitsForObject(p uintptr) (base uintptr, hbits heapBits, s *mspan) { // The following ensures that we are rigorous about what data // structures hold valid pointers. // TODO(rsc): Check if this still happens. - if true { + if debug.invalidptr != 0 { // Still happens sometimes. We don't know why. printlock() print("runtime:objectstart Span weird: p=", hex(p), " k=", hex(k)) diff --git a/src/runtime/runtime1.go b/src/runtime/runtime1.go index db26995703..a50e5b618c 100644 --- a/src/runtime/runtime1.go +++ b/src/runtime/runtime1.go @@ -299,8 +299,6 @@ type dbgVar struct { value *int32 } -// TODO(rsc): Make GC respect debug.invalidptr. - // Holds variables parsed from GODEBUG env var, // except for "memprofilerate" since there is an // existing int var for that value, which may @@ -340,6 +338,9 @@ var dbgvars = []dbgVar{ } func parsedebugvars() { + // defaults + debug.invalidptr = 1 + for p := gogetenv("GODEBUG"); p != ""; { field := "" i := index(p, ",")