]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: fix linkname signature for godebug
authorAdin Scannell <ascannell@google.com>
Thu, 23 Feb 2023 22:22:29 +0000 (22:22 +0000)
committerGopher Robot <gobot@golang.org>
Thu, 23 Feb 2023 23:09:10 +0000 (23:09 +0000)
This signature uses the wrong type for the passed function, which
will be saved in the internal runtime map. Since the functions are
likely compatible (uint64 return versus int64), this may work but
should generally be fixed.

This is other instance of #58440.

Change-Id: Ied82e554745ef72eefeb5be540605809ffa06533
Reviewed-on: https://go-review.googlesource.com/c/go/+/470915
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Michael Pratt <mpratt@google.com>

src/internal/godebug/godebug.go

index 443868c384ebf4a23bebc33320ae8de79f10623c..fc6fcb92e225cc29972b146791b29a57f23ef897 100644 (file)
@@ -45,7 +45,7 @@ type Setting struct {
 type setting struct {
        value          atomic.Pointer[string]
        nonDefaultOnce sync.Once
-       nonDefault     atomic.Int64
+       nonDefault     atomic.Uint64
 }
 
 // New returns a new Setting for the $GODEBUG setting with the given name.
@@ -145,7 +145,7 @@ func setUpdate(update func(string, string))
 // It forwards registrations to runtime/metrics.
 //
 //go:linkname registerMetric
-func registerMetric(name string, read func() int64)
+func registerMetric(name string, read func() uint64)
 
 // setNewNonDefaultInc is provided by package runtime.
 // The runtime can do