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

randall77 opened this issue Aug 2, 2019 · 1 comment

cmd/compile: crash on write barrier insertion #33438

randall77 opened this issue Aug 2, 2019 · 1 comment


Copy link

@randall77 randall77 commented Aug 2, 2019

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

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Aug 2, 2019

Change mentions this issue: cmd/compile: fix crash on write barrier insertion

@gopherbot gopherbot closed this in 316ac4f Aug 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.