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: mishandles int->complex conversion #11365

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

cmd/compile: mishandles int->complex conversion #11365

dvyukov opened this issue Jun 23, 2015 · 2 comments
Milestone

Comments

@dvyukov
Copy link
Member

dvyukov commented Jun 23, 2015

Output of the following program

package main
var a = complex64(4e38)
func main() {
    println(a)
}

is (when built with gc compiler):

(+Inf+0.000000e+000i)

This is wrong. The conversion must not be compiled as the constant does not fit into complex64.

The following program hangs infinitely in go tool compile:

package main

func main() {
    var a = complex64(4e38)
    println(a)
}

Seems to be the same issue.

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

@dvyukov dvyukov changed the title cmd/compile: cmd/compile: mishandles int->complex conversion Jun 23, 2015
@dvyukov
Copy link
Member Author

dvyukov commented Jun 29, 2015

Probably the same issue:

package main
var a = complex64(0)/700000000000000000000000000000000000000

must not be compiled, but gc compiles successfully.

@ianlancetaylor ianlancetaylor added this to the Go1.6 milestone Jul 11, 2015
@rsc
Copy link
Contributor

rsc commented Nov 4, 2015

Dup of #11590.

@rsc rsc closed this as completed Nov 4, 2015
@golang golang locked and limited conversation to collaborators Nov 4, 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

4 participants