Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
josharian opened this issue Oct 26, 2016 · 2 comments
Closed

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

josharian opened this issue Oct 26, 2016 · 2 comments
Milestone

Comments

@josharian
Copy link
Contributor

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).

@josharian josharian added this to the Unplanned milestone Oct 26, 2016
@griesemer griesemer changed the title go/types: accepts floating point literals with no decimals after E go/parser: accepts floating point literals with no decimals after E Oct 26, 2016
@griesemer griesemer modified the milestones: Go1.8, Unplanned Oct 26, 2016
@griesemer griesemer self-assigned this Oct 26, 2016
@griesemer
Copy link
Contributor

holy cow!

@griesemer griesemer changed the title go/parser: accepts floating point literals with no decimals after E go/scanner: accepts floating point literals with no decimals after E Oct 26, 2016
@gopherbot
Copy link

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

@golang golang locked and limited conversation to collaborators Oct 26, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants