Skip to content

cmd/gc: Slice access of const causes strange string errors (Bug introduced in go1.3, doesn't happen in go <= 1.2) #8325

@gopherbot

Description

@gopherbot

by psnim2000:

What does 'go version' print?
go version go1.3 darwin/amd64 (first discovered in go version go1.3 linux/amd64)

What steps reproduce the problem?
If possible, include a link to a program on play.golang.org.
http://play.golang.org/p/RwqaHkITff
 
What happened?
See attached program. 
If you run this program on go1.3, you will get something like.
Hello, playground PLCM7w9WX0F4Fs9Yz9.0699t A5

If you run this program on go1.2, you will get something like
Hello, playground PLCM2IE95QPT6ZLUAX218417FLX3449NEJ5D

What should have happened instead?
The code shouldn't return any characters after [A-Z0-9]
If you notice the output under go1.3, the value outside of [A-Z0-9] shouldn't be
possible. I'm unsure if the output value is even valid UTF-8.

Please provide any additional information below.
This error was uncovered after upgrading a service to go1.3. We tested the function with
go1 and go1.2, and the problem doesn't occur.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions