]> Cypherpunks repositories - gostls13.git/commit
cmd/compile, runtime: fix pedantic int->string conversions
authorMatthew Dempsky <mdempsky@google.com>
Thu, 31 Mar 2016 09:04:12 +0000 (02:04 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Thu, 31 Mar 2016 10:28:23 +0000 (10:28 +0000)
commite6066711a0f92824ded94849e4f1085c2ba612c3
treefd3692ad25b1caf5c3674c9927d30e4e011c977c
parente7538df7011e3767e9350655ea51edb894d61423
cmd/compile, runtime: fix pedantic int->string conversions

Previously, cmd/compile rejected constant int->string conversions if
the integer value did not fit into an "int" value. Also, runtime
incorrectly truncated 64-bit values to 32-bit before checking if
they're a valid Unicode code point. According to the Go spec, both of
these cases should instead yield "\uFFFD".

Fixes #15039.

Change-Id: I3c8a3ad9a0780c0a8dc1911386a523800fec9764
Reviewed-on: https://go-review.googlesource.com/21344
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/cmd/compile/internal/gc/const.go
src/runtime/string.go
test/fixedbugs/issue15039.go [new file with mode: 0644]