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 converting int const to complex64 #11597

Closed
dvyukov opened this issue Jul 4, 2015 · 4 comments
Closed

cmd/compile: hangs converting int const to complex64 #11597

dvyukov opened this issue Jul 4, 2015 · 4 comments
Milestone

Comments

@dvyukov
Copy link
Member

dvyukov commented Jul 4, 2015

gc hangs compiling the following program:

package p
func f() { _ = complex64(0x9EEbcab0Aa2DDe942Ea0aef5Aeb6bFF2dfcaf) }

go version devel +71832ff Fri Jul 3 21:39:04 2015 +0000 linux/amd64

@ianlancetaylor ianlancetaylor added this to the Go1.6 milestone Jul 10, 2015
@ALTree
Copy link
Member

ALTree commented Nov 3, 2015

The compiler gets stuck trying to print an error message.

While compiling the above snippet, gc reaches the following line in the overflow function inside gc/compile/const.go:

Yyerror("constant %s overflows %v", Vconv(v, 0), t)

Vconv calls the Fconv function in gc/compile/mparith3, where gc dies in an infinite loop caused by the fact that the number to be printed in the error message is +Inf, but Fconv tries to scale it to a reasonable size in a loop before printing the error, dividing it by 10 and checking for m => 10 (which will never became false if m is +Inf).

A quick way to fix this is to change the overflow function so that it doesn't print any error when it gets Inf floats (which is correct, since +Inf does not overflows float32 o float64: it's a valid float32 value).

A const xxxx overflows float32 is already printed by the frontend when the number is parsed the first time, so we shouldn't loose any informative error message (I hope).

@ALTree
Copy link
Member

ALTree commented Nov 3, 2015

Nope, looks like we lose the error message in certain cases. It's probably better to fix the Fconv function so that at least it prints something on Inf input.

@gopherbot
Copy link
Contributor

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

@rsc
Copy link
Contributor

rsc commented Nov 4, 2015

Dup of #11590.

@rsc rsc closed this as completed Nov 16, 2015
@golang golang locked and limited conversation to collaborators Nov 16, 2016
@rsc rsc removed their assignment Jun 23, 2022
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