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

runtime: pcdata is -2 and 12 locals stack map entries error on nil pointer [1.14 backport] #40647

Closed
gopherbot opened this issue Aug 8, 2020 · 3 comments
Labels
CherryPickApproved FrozenDueToAge release-blocker
Milestone

Comments

@gopherbot
Copy link

@gopherbot gopherbot commented Aug 8, 2020

@randall77 requested issue #40629 to be considered for backport to the next 1.14 minor release.

This patch:

+++ b/src/cmd/compile/internal/ssa/func.go
@@ -274,6 +274,9 @@ func (f *Func) freeValue(v *Value) {
        if len(v.Args) != 0 {
                f.Fatalf("value %s still has %d args", v, len(v.Args))
        }
+       if v == f.LastDeferExit {
+               println("FREEING THE LASTDEFEREXIT")
+       }
        // Clear everything but ID (which we reuse).
        id := v.ID

triggers a bunch of times during make.bash. Both 1.14.2 and tip. Looks like we need to fix this for the release - I think we're just getting lucky that we don't stack copy or gc trace such cases normally (stack copy is only likely to happen with an unrecovered panic?), or that the random other instruction's liveness map is correct (or good enough).

@gopherbot please open a backport issue for 1.14.

1.13 is ok, as open-coded defers were released for 1.14.

@gopherbot gopherbot added the CherryPickCandidate label Aug 8, 2020
@gopherbot gopherbot added this to the Go1.14.8 milestone Aug 8, 2020
@gopherbot
Copy link
Author

@gopherbot gopherbot commented Aug 14, 2020

Change https://golang.org/cl/248622 mentions this issue: cmd/compile: fix live variable computation for deferreturn

@dmitshur dmitshur removed this from the Go1.14.8 milestone Sep 1, 2020
@dmitshur dmitshur added this to the Go1.14.9 milestone Sep 1, 2020
@dmitshur dmitshur removed this from the Go1.14.9 milestone Sep 9, 2020
@dmitshur dmitshur added this to the Go1.14.10 milestone Sep 9, 2020
@toothrot
Copy link
Contributor

@toothrot toothrot commented Sep 11, 2020

Approved. This is a serious issue with no workaround.

@toothrot toothrot added the CherryPickApproved label Sep 11, 2020
@gopherbot gopherbot removed the CherryPickCandidate label Sep 11, 2020
gopherbot pushed a commit that referenced this issue Oct 5, 2020
…r deferreturn

Taking the live variable set from the last return point is problematic.
See #40629 for details, but there may not be a return point, or it may
be before the final defer.

Additionally, keeping track of the last call as a *Value doesn't quite
work. If it is dead-code eliminated, the storage for the Value is reused
for some other random instruction. Its live variable information,
if it is available at all, is wrong.

Instead, just mark all the open-defer argument slots as live
throughout the function. (They are already zero-initialized.)

Fixes #40647

Change-Id: Ie456c7db3082d0de57eaa5234a0f32525a1cce13
Reviewed-on: https://go-review.googlesource.com/c/go/+/247522
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
(cherry picked from commit 32a84c9)
Reviewed-on: https://go-review.googlesource.com/c/go/+/248622
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
@gopherbot
Copy link
Author

@gopherbot gopherbot commented Oct 5, 2020

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

@golang golang locked and limited conversation to collaborators Oct 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CherryPickApproved FrozenDueToAge release-blocker
Projects
None yet
Development

No branches or pull requests

4 participants