You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The gccgo compiler crashes with int-to-string conversion with
large integer constant operand. CL 179777 is the fix. This CL
adds a test.
Updates #32347.
Change-Id: Id1d9dbbcdd3addca4636f1b9c5fdbc450cc48c1d
Reviewed-on: https://go-review.googlesource.com/c/go/+/179797
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
kraj
pushed a commit
to kraj/gcc
that referenced
this issue
May 31, 2019
Currently, Type_conversion_expression::do_is_constant thinks the
int-to-string conversion is constant if the integer operand is
constant, but Type_conversion_expression::do_get_backend actually
generates a call to runtime.intstring if the integer does not fit
in a "ushort", which makes it not suitable in constant context,
such as static initializer.
This CL makes it handle all constant integer input as constant,
generating constant string.
Fixesgolang/go#32347.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/179777
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@271821 138bc75d-0d04-0410-961f-82ee72b054a4
What version of Go are you using (
go version
)?gccgo (GCC) 10.0.0 20190531 (experimental)
What operating system and processor architecture are you using (
go env
)?Linux/AMD64
What did you do?
Compiling the following program
https://play.golang.org/p/7r8MnMRjv9B
What did you expect to see?
Success.
What did you see instead?
It appears to me that
Type_conversion_expression::do_is_constant
thinks the int-to-string conversion is constant, butType_conversion_expression::do_get_backend
actually generates a call toruntime.intstring
if the integer does not fit in a "ushort" (https://go.googlesource.com/gofrontend/+/4dc60d989293d070702024e7dea52b9849f74775/go/expressions.cc#3846).Changing ushort to uint fixes this, albeit that it prints a warning if the integer is not valid unicode, e.g.
string(0x110000)
,The text was updated successfully, but these errors were encountered: