golang/go

gccgo: accepts invalid UTF-8

dvyukov opened this issue · 4 comments

gcc compiles the following program, while gc and go/types reject it:

package G
//line \FF:8

(that \FF needs to be converted to actual FF byte)
gc and go/types say:

go.go:2:8: illegal UTF-8 encoding
go.go:2: illegal UTF-8 sequence ff 3a

Compilers should agree on validity of this program.

gcc version 6.0.0 2015070 (experimental) (GCC)

Is this still a problem? gc and go/types also accept the above program so it seems all compilers agree on the validity of the program.

replace \ff with actual 0xff byte

CL https://golang.org/cl/13905 mentions this issue.