Skip to content

x/tools/gopls: impossible panic in BlockStmt.End (type checking IfStmt with nil Body) #76327

@adonovan

Description

@adonovan
#!stacks
"sigpanic" && "go/ast.(*BlockStmt).End:+1" && "go/types.(*Checker).openScope"

Issue created by stacks.

IfStmt.Body is nil (or invalid). This can't happen in the result of the parser, ergo more memory corruption.

This stack p7b91g was reported by telemetry:

golang.org/x/tools/gopls@v0.20.0 go1.25.0 linux/amd64 gopls.client=vscode (1)

Use this command to reproduce the executable:
(HOME=$(mktemp -d); GOOS=linux GOARCH=amd64 GOTOOLCHAIN=go1.25.0 go install golang.org/x/tools/gopls@v0.20.0 && find $HOME/go/bin -type f)
To disassemble: go tool objdump exe | less

Metadata

Metadata

Assignees

No one assigned

    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.ToolsThis label describes issues relating to any tools in the x/tools repository.goplsIssues related to the Go language server, gopls.gopls/memory-corruption"can't happen" gopls crashes (races, unsafe, miscompile, runtime bugs, faulty HW)gopls/telemetry-wins

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions