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/constant: hang evaluating "-6e-1886451601" #20228

Closed
josharian opened this issue May 3, 2017 · 3 comments
Closed

go/constant: hang evaluating "-6e-1886451601" #20228

josharian opened this issue May 3, 2017 · 3 comments
Milestone

Comments

@josharian
Copy link
Contributor

go/types appears to hang while typechecking:

package p

var x = -6e-1886451601

It appears to be stuck (or just doing a lot of work?) in karatsuba:

goroutine 5 [runnable]:
math/big.karatsubaAdd(0xc42996cb00, 0xfbc6a0, 0xfbc6a4, 0xc429973e00, 0xfbb840, 0xfbb844, 0x5c0)
	/Users/josh/go/tip/src/math/big/nat.go:236 +0x129
math/big.karatsuba(0xc42996b400, 0xfbc980, 0xfbc984, 0xc429965800, 0x5c0, 0xfbd504, 0xc429968600, 0x5c0, 0xfbcf44)
	/Users/josh/go/tip/src/math/big/nat.go:347 +0x731
math/big.karatsuba(0xc42995a000, 0xfbec00, 0xfbec04, 0xc424e3d000, 0xb80, 0x7df604, 0xc424e3d000, 0xb80, 0x7df604)
	/Users/josh/go/tip/src/math/big/nat.go:329 +0x506
math/big.karatsuba(0xc42995a000, 0xfbec00, 0xfbec04, 0xc424e3d000, 0x1700, 0x7df604, 0xc424e3d000, 0x1700, 0x7df604)
	/Users/josh/go/tip/src/math/big/nat.go:308 +0x1ad
math/big.karatsuba(0xc42995a000, 0xfbec00, 0xfbec04, 0xc424e3d000, 0x2e00, 0x7df604, 0xc424e3d000, 0x2e00, 0x7df604)
	/Users/josh/go/tip/src/math/big/nat.go:308 +0x1ad
math/big.karatsuba(0xc42992c000, 0xfc4800, 0xfc4804, 0xc424e26000, 0x5c00, 0x7e2404, 0xc424e26000, 0x5c00, 0x7e2404)
	/Users/josh/go/tip/src/math/big/nat.go:309 +0x28f
math/big.karatsuba(0xc4298d0000, 0xfd0000, 0xfd0004, 0xc424df8000, 0xb800, 0x7e8004, 0xc424df8000, 0xb800, 0x7e8004)
	/Users/josh/go/tip/src/math/big/nat.go:309 +0x28f
math/big.karatsuba(0xc4298d0000, 0xfd0000, 0xfd0004, 0xc424df8000, 0x17000, 0x7e8004, 0xc424df8000, 0x17000, 0x7e8004)
	/Users/josh/go/tip/src/math/big/nat.go:308 +0x1ad
math/big.karatsuba(0xc4298d0000, 0xfd0000, 0xfd0004, 0xc424df8000, 0x2e000, 0x7e8004, 0xc424df8000, 0x2e000, 0x7e8004)
	/Users/josh/go/tip/src/math/big/nat.go:308 +0x1ad
math/big.karatsuba(0xc4298d0000, 0xfd0000, 0xfd0004, 0xc424df8000, 0x5c000, 0x7e8004, 0xc424df8000, 0x5c000, 0x7e8004)
	/Users/josh/go/tip/src/math/big/nat.go:308 +0x1ad
math/big.karatsuba(0xc4298d0000, 0xfd0000, 0xfd0004, 0xc424df8000, 0xb8000, 0x7e8004, 0xc424df8000, 0xb8000, 0x7e8004)
	/Users/josh/go/tip/src/math/big/nat.go:308 +0x1ad
math/big.karatsuba(0xc428d50000, 0x1140000, 0x1140004, 0xc424838000, 0x170000, 0x8a0004, 0xc424838000, 0x170000, 0x8a0004)
	/Users/josh/go/tip/src/math/big/nat.go:309 +0x28f
math/big.karatsuba(0xc428d50000, 0x1140000, 0x1140004, 0xc424838000, 0x2e0000, 0x8a0004, 0xc424838000, 0x2e0000, 0x8a0004)
	/Users/josh/go/tip/src/math/big/nat.go:308 +0x1ad
math/big.nat.mul(0xc4224fe000, 0x17585a, 0x450004, 0xc424838000, 0x2eb0b3, 0x8a0004, 0xc424838000, 0x2eb0b3, 0x8a0004, 0xc424838000, ...)
	/Users/josh/go/tip/src/math/big/nat.go:432 +0x1b9
math/big.nat.expNN(0x0, 0x0, 0x0, 0x1465148, 0x1, 0x1, 0xc42001a2a0, 0x1, 0x5, 0x0, ...)
	/Users/josh/go/tip/src/math/big/nat.go:939 +0x30c
math/big.(*Rat).SetString(0xc420058c40, 0xc420014430, 0xd, 0xc42000ed20, 0x1)
	/Users/josh/go/tip/src/math/big/ratconv.go:115 +0x626
go/constant.makeFloatFromLiteral(0xc420014430, 0xd, 0x0, 0x0)
	/Users/josh/go/tip/src/go/constant/value.go:250 +0xf0
go/constant.MakeFromLiteral(0xc420014430, 0xd, 0x6, 0x0, 0x0, 0x0)
	/Users/josh/go/tip/src/go/constant/value.go:325 +0x80
go/types.(*operand).setConst(0xc420058c00, 0x6, 0xc420014430, 0xd)
	/Users/josh/go/tip/src/go/types/operand.go:187 +0xa5
go/types.(*Checker).exprInternal(0xc4200e0000, 0xc420058c00, 0x1469520, 0xc42000a320, 0x0, 0x0, 0x0)
	/Users/josh/go/tip/src/go/types/expr.go:998 +0x2a5a
go/types.(*Checker).rawExpr(0xc4200e0000, 0xc420058c00, 0x1469520, 0xc42000a320, 0x0, 0x0, 0x0)
	/Users/josh/go/tip/src/go/types/expr.go:945 +0x81
go/types.(*Checker).multiExpr(0xc4200e0000, 0xc420058c00, 0x1469520, 0xc42000a320)
	/Users/josh/go/tip/src/go/types/expr.go:1481 +0x62
go/types.(*Checker).expr(0xc4200e0000, 0xc420058c00, 0x1469520, 0xc42000a320)
	/Users/josh/go/tip/src/go/types/expr.go:1475 +0x49
go/types.(*Checker).exprInternal(0xc4200e0000, 0xc420058c00, 0x1469fa0, 0xc42000a340, 0x0, 0x0, 0xc42004e940)
	/Users/josh/go/tip/src/go/types/expr.go:1395 +0x1a9a
go/types.(*Checker).rawExpr(0xc4200e0000, 0xc420058c00, 0x1469fa0, 0xc42000a340, 0x0, 0x0, 0x0)
	/Users/josh/go/tip/src/go/types/expr.go:945 +0x81
go/types.(*Checker).multiExpr(0xc4200e0000, 0xc420058c00, 0x1469fa0, 0xc42000a340)
	/Users/josh/go/tip/src/go/types/expr.go:1481 +0x62
go/types.(*Checker).expr(0xc4200e0000, 0xc420058c00, 0x1469fa0, 0xc42000a340)
	/Users/josh/go/tip/src/go/types/expr.go:1475 +0x49
go/types.(*Checker).varDecl(0xc4200e0000, 0xc4200857c0, 0xc42000c0a8, 0x1, 0x1, 0x0, 0x0, 0x1469fa0, 0xc42000a340)
	/Users/josh/go/tip/src/go/types/decl.go:166 +0x27c
go/types.(*Checker).objDecl(0xc4200e0000, 0x146c2c0, 0xc4200857c0, 0x0, 0xc42004ac50, 0x0, 0x8)
	/Users/josh/go/tip/src/go/types/decl.go:81 +0x223
go/types.(*Checker).packageObjects(0xc4200e0000, 0xc42004e950, 0x1, 0x1)
	/Users/josh/go/tip/src/go/types/resolver.go:457 +0x105
go/types.(*Checker).checkFiles(0xc4200e0000, 0xc42004ae30, 0x1, 0x1, 0x0, 0x0)
	/Users/josh/go/tip/src/go/types/check.go:239 +0xdb
go/types.(*Checker).Files(0xc4200e0000, 0xc42004ae30, 0x1, 0x1, 0xc42000ecc0, 0x0)
	/Users/josh/go/tip/src/go/types/check.go:230 +0x49
go/types.(*Config).Check(0xc420058bc0, 0x12f539e, 0x1, 0xc420058b40, 0xc42004ae30, 0x1, 0x1, 0xc420085680, 0x0, 0x2, ...)
	/Users/josh/go/tip/src/go/types/api.go:351 +0x1b3
go/types_test.TestIssue16902(0xc4200de0f0)
	/Users/josh/go/tip/src/go/types/sizes_test.go:102 +0x31f
testing.tRunner(0xc4200de0f0, 0x130bd00)
	/Users/josh/go/tip/src/testing/testing.go:747 +0xd0
created by testing.(*T).Run
	/Users/josh/go/tip/src/testing/testing.go:789 +0x2de

Does not affect cmd/compile.

Found using go-fuzz.

@griesemer
Copy link
Contributor

Probably doing insane amounts of work... - though it may finish before the Universe ends, with some luck :-)

(and yes, should probably fix but low priority)

@josharian
Copy link
Contributor Author

I was curious...so I fixed it. :)

@gopherbot
Copy link
Contributor

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

@golang golang locked and limited conversation to collaborators May 4, 2018
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