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: conversion from int/float typed constant to complex variable changed in 1.14 [1.14 backport] #38123

Closed
gopherbot opened this issue Mar 28, 2020 · 3 comments
Labels
CherryPickApproved Used during the release process for point releases FrozenDueToAge
Milestone

Comments

@gopherbot
Copy link

@ianlancetaylor requested issue #38117 to be considered for backport to the next 1.14 minor release.

Looks like we're going back to the 1.13 behavior. I'll let @griesemer review the CL, but:

@gopherbot Please open a backport to 1.14.

The compiler behavior changed the way it handles constant conversions. This can break existing programs with no workaround other than rewriting the program, which should not be needed.

@gopherbot gopherbot added the CherryPickCandidate Used during the release process for point releases label Mar 28, 2020
@gopherbot gopherbot added this to the Go1.14.2 milestone Mar 28, 2020
@andybons andybons added the CherryPickApproved Used during the release process for point releases label Apr 7, 2020
@gopherbot gopherbot removed the CherryPickCandidate Used during the release process for point releases label Apr 7, 2020
@andybons
Copy link
Member

andybons commented Apr 7, 2020

Approved as this is a regression with no workaround.

@andybons andybons modified the milestones: Go1.14.2, Go1.14.3 Apr 8, 2020
@gopherbot
Copy link
Author

Change https://golang.org/cl/232719 mentions this issue: [release-branch.go1.14] cmd/compile: fix constant conversion involving complex types

@gopherbot
Copy link
Author

Closed by merging f4274e6 to release-branch.go1.14.

gopherbot pushed a commit that referenced this issue May 8, 2020
…g complex types

In CL 187657, I refactored constant conversion logic without realizing
that conversions between int/float and complex types are allowed for
constants (assuming the constant values are representable by the
destination type), but are never allowed for non-constant expressions.

This CL expands convertop to take an extra srcConstant parameter to
indicate whether the source expression is a constant; and if so, to
allow any numeric-to-numeric conversion. (Conversions of values that
cannot be represented in the destination type are rejected by
evconst.)

Fixes #38123.
For #38117.

Change-Id: Id7077d749a14c8fd910be38da170fa5254819f2b
Reviewed-on: https://go-review.googlesource.com/c/go/+/226197
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
(cherry picked from commit 3431428)
Reviewed-on: https://go-review.googlesource.com/c/go/+/232719
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
@golang golang locked and limited conversation to collaborators May 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CherryPickApproved Used during the release process for point releases FrozenDueToAge
Projects
None yet
Development

No branches or pull requests

2 participants