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: crash on write barrier insertion #33438

Closed
randall77 opened this issue Aug 2, 2019 · 1 comment
Closed

cmd/compile: crash on write barrier insertion #33438

randall77 opened this issue Aug 2, 2019 · 1 comment

Comments

@randall77
Copy link
Contributor

package main

type hasPtrs struct {
        x [2]*int
}

func main() {
        var x *hasPtrs       // Can be local, global, or arg; nil or non-nil.
        var y *hasPtrs = nil // Must initialize to nil.
        *x = *y
}

This code crashes when trying to insert a write barrier. It thinks the nil pointer being read from is a global pointer, then tries to find the symbol backing that pointer. Oops.

This will only happen for code that unconditionally panics while reading from the nil pointer. Not terribly interesting code, but it happens in Google. Things like:

func f() {
    if newFeature {
        v := *getNewFeaturePointer()
   }
}
func getNewFeaturePointer() *int {
    return nil // TODO: not implemented yet
}
var newFeature bool // don't enable this yet!

Started failing with CL 156363

@randall77 randall77 self-assigned this Aug 2, 2019
@gopherbot
Copy link

Change https://golang.org/cl/188760 mentions this issue: cmd/compile: fix crash on write barrier insertion

@golang golang locked and limited conversation to collaborators Aug 1, 2020
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