Skip to content

cmd/compile: late nil-check elimination changes nil-pointer access order #80518

Description

@jake-ciolek

Go version

go 1.26.5, go 1.25.12, tip

Output of go env in your module/workspace:

GOARCH=amd64

What did you do?

Note, this was originally reported to security@golang.org, but the policy has changed and I was told to create a public issue.

package main

//go:noinline
func faultAt(p *[1 << 32]byte) byte {
	return p[0xdeadbeef] + p[0]
}

func main() {
	defer func() { recover() }()
	_ = faultAt(nil)
}

What did you see happen?

$ go run .
unexpected fault address 0xdeadbeef
fatal error: fault
[signal SIGSEGV: segmentation violation code=0x1 addr=0xdeadbeef pc=0x47a785]

What did you expect to see?

No SIGSEGV (doesn't happen on unoptimized builds).

Metadata

Metadata

Assignees

Labels

BugReportIssues describing a possible bug in the Go implementation.NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.compiler/runtimeIssues related to the Go compiler and/or runtime.

Type

Projects

Status
Todo

Relationships

None yet

Development

No branches or pull requests

Issue actions