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: double error on overflow during ideal -> float{32,64} conversion #19947

Closed
ALTree opened this issue Apr 12, 2017 · 1 comment
Closed
Milestone

Comments

@ALTree
Copy link
Member

ALTree commented Apr 12, 2017

go version devel +746441f97f Wed Apr 12 18:16:41 2017 +0000 linux/amd64

Consider the following:

package p

var _ = float32(1) * 1e200
var _ = float64(1) * 1e500

var _ = complex64(1) * 1e200
var _ = complex128(1) * 1e500

on tip (1.8 too) we get a double error on the first two lines (but not on the last two):

./prova.go:3:16: constant Inf overflows float32
./prova.go:3:20: constant 1e+200 overflows float32
./prova.go:4:16: constant Inf overflows float64
./prova.go:4:20: constant 1e+500 overflows float64

./prova.go:5:22: constant 1e+200 overflows complex64
./prova.go:6:23: constant 1e+500 overflows complex128

The lines complaining about Inf overflow should go (they're confusing, there's no Inf in the code).

It should be enough to avoid overwriting the original Node's Val in case of overflow in truncfltlit( ) (like we already do in the recently committed trunccmplxlit( )).

@ALTree ALTree added this to the Go1.9 milestone Apr 12, 2017
@ALTree ALTree self-assigned this Apr 12, 2017
@gopherbot
Copy link

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

lparth pushed a commit to lparth/go that referenced this issue Apr 13, 2017
…flow

Also adjust truncfltlit to make it more similar to trunccmplxlit, and
make it report an error for bad Etypes.

Fixes golang#19947

Change-Id: I6684523e989c2293b8a8e85bd2bfb9c399c5ea36
Reviewed-on: https://go-review.googlesource.com/40453
Reviewed-by: Robert Griesemer <gri@golang.org>
@golang golang locked and limited conversation to collaborators Apr 12, 2018
@rsc rsc unassigned ALTree 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

2 participants