golang/go

go/scanner: accepts floating point literals with no decimals after E

josharian opened this issue · 2 comments

package main

const X = 0E
$ go tool compile x.go
x.go:3: malformed floating-point constant exponent
x.go:3: malformed constant: 0E
$ gotype x.go
$

gccgo also rejects this code. gc and gccgo are correct. From the spec's floating-point literal definition: exponent = ( "e" | "E" ) [ "+" | "-" ] decimals .

cc @mdempsky @griesemer

Found using go-fuzz (@dvyukov).

holy cow!

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