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: internal error on call with parenthesized builtin #63436

Closed
jba opened this issue Oct 7, 2023 · 2 comments
Closed

cmd/compile: internal error on call with parenthesized builtin #63436

jba opened this issue Oct 7, 2023 · 2 comments
Assignees
Labels
NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@jba
Copy link
Contributor

jba commented Oct 7, 2023

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

$ go version
go version devel go1.22-6e8caefc19 Fri Oct 6 22:31:47 2023 +0000 linux/amd64 

Does this issue reproduce with the latest release?

Yes.

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

linux/amd64

What did you do?

package main

import "fmt"

func main() {
	x := []int{1, 2, 3}
	x = (append)(x, 4)
	fmt.Println(x)
}

What did you expect to see?

success

What did you see instead?

<unknown line number>: internal compiler error: panic: runtime error: invalid memory address or nil pointer dereference
@seankhliao seankhliao changed the title compiler: internal error on call with parenthesized builtin cmd/compile: internal error on call with parenthesized builtin Oct 7, 2023
@cuonglm
Copy link
Member

cuonglm commented Oct 7, 2023

Smaller reproducer:

package p

var _ = (new)(int)

@cuonglm cuonglm self-assigned this Oct 7, 2023
@cuonglm cuonglm added the NeedsFix The path to resolution is known, but the work has not been done. label Oct 7, 2023
@cuonglm cuonglm added this to the Go1.22 milestone Oct 7, 2023
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/533476 mentions this issue: cmd/compile: fix ICE with parenthesized builtin calls

yunginnanet pushed a commit to yunginnanet/go that referenced this issue Oct 20, 2023
CL 419456 starts using lookupObj to find types2.Object associated with
builtin functions. However, the new code does not un-parenthesized the
callee expression, causing an ICE because of nil obj returned.

Un-parenthesizing the callee expression fixes the problem.

Fixes golang#63436

Change-Id: Iebb4fbc08575e7d0b1dbd026c98e8f949ca16460
Reviewed-on: https://go-review.googlesource.com/c/go/+/533476
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

3 participants