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

cmd/compile: hangs compiling hex fp constant #11364

Closed
dvyukov opened this issue Jun 23, 2015 · 3 comments
Closed

cmd/compile: hangs compiling hex fp constant #11364

dvyukov opened this issue Jun 23, 2015 · 3 comments

Comments

@dvyukov
Copy link
Member

dvyukov commented Jun 23, 2015

go tool compile hangs in karatsuba compiling the following program:

package a
var e = 1<<1p10000000<<3

Can we just break off hex exponents (p)? They are not supported by go/types-based frontends and so are non-portable.

go version devel +514014c Thu Jun 18 15:54:35 2015 +0200 linux/amd64

@griesemer griesemer assigned dr2chase and unassigned rsc Jun 23, 2015
@griesemer
Copy link
Contributor

Floating-point constants with binary ('p') exponents are not permitted in the source and that has been fixed (issue #9036). E.g.:

package p
const _ = 1p10

is not accepted anymore:
x.go:2: malformed floating point constant

However, it appears that the numbers are still recognized (and not set to 0 or 1) and then make it through the rest of type-checking/constant evaluation:

package p
const _ = 1 << 1p10

x.go:2: malformed floating point constant
x.go:2: stupid shift: 1024

The fact that we hang in Karatsuba is known and is effectively (indirectly) a duplicate of #11327. But once we set 'p' exponent values to 0, the hang should disappear.

Assigning to @dr2chase who fixed issue #9036.

@griesemer griesemer added this to the Unplanned milestone Jun 23, 2015
@dr2chase
Copy link
Contributor

This appears to be fixed. New parser?

$ cat > bug11364.go
package a
var e = 1<<1p10000000<<3
$ go tool compilebug11364.go
go tool compile bug11364.go
bug11364.go:2: syntax error: unexpected p10000000 after top level declaration

and it wastes no time telling me that.

@griesemer
Copy link
Contributor

@dr2chase Fixed by you in https://go-review.googlesource.com/c/10450/ I think.

@golang golang locked and limited conversation to collaborators Oct 21, 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

5 participants