Skip to content

cmd/compile: declaring non-callable append then attempting to call crashes gc #28211

@Xjs

Description

@Xjs

What version of Go are you using (go version)?

go version go1.11 windows/amd64 (also occurs under Linux or on the playground)

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

GOHOSTARCH=amd64
GOHOSTOS=windows

(also happens on playground)

What did you do?

MWE:

package main

func main() {
	var append bool
	append()
}

https://play.golang.org/p/Z36gAU5mgUY

What did you expect to see?

prog.go:5:9: cannot call non-function append (type bool)

What did you see instead?

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x70 pc=0xb7c7ee]

goroutine 1 [running]:
cmd/compile/internal/gc.typecheck1(0xc00032c180, 0x1, 0xc00032c080)
	/usr/local/go/src/cmd/compile/internal/gc/typecheck.go:1270 +0x3ece
cmd/compile/internal/gc.typecheck(0xc00032c180, 0x1, 0xc00032c080)
	/usr/local/go/src/cmd/compile/internal/gc/typecheck.go:238 +0x6ad
cmd/compile/internal/gc.typecheckslice(0xc0003201c0, 0x3, 0x4, 0x1)
	/usr/local/go/src/cmd/compile/internal/gc/typecheck.go:68 +0x50
cmd/compile/internal/gc.Main(0xcc2180)
	/usr/local/go/src/cmd/compile/internal/gc/main.go:518 +0x2059
main.main()
	/usr/local/go/src/cmd/compile/main.go:51 +0x96

Spotted by @Weiss91

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeWaitingForInfoIssue is not actionable because of missing required information, which needs to be provided.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions