Skip to content

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

Closed
@dvyukov

Description

@dvyukov

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions