Skip to content

Commit 2744155

Browse files
cuonglmgopherbot
authored andcommitted
cmd/compile: fix ICE with parenthesized builtin calls
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 #63436 Change-Id: Iebb4fbc08575e7d0b1dbd026c98e8f949ca16460 Reviewed-on: https://go-review.googlesource.com/c/go/+/533476 Auto-Submit: Cuong Manh Le <[email protected]> Reviewed-by: Keith Randall <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Matthew Dempsky <[email protected]> Reviewed-by: Keith Randall <[email protected]>
1 parent f711892 commit 2744155

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/cmd/compile/internal/noder/writer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1909,7 +1909,7 @@ func (w *writer) expr(expr syntax.Expr) {
19091909

19101910
var rtype types2.Type
19111911
if tv.IsBuiltin() {
1912-
switch obj, _ := lookupObj(w.p, expr.Fun); obj.Name() {
1912+
switch obj, _ := lookupObj(w.p, syntax.Unparen(expr.Fun)); obj.Name() {
19131913
case "make":
19141914
assert(len(expr.ArgList) >= 1)
19151915
assert(!expr.HasDots)

test/fixedbugs/issue63436.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// compile
2+
3+
// Copyright 2023 The Go Authors. All rights reserved.
4+
// Use of this source code is governed by a BSD-style
5+
// license that can be found in the LICENSE file.
6+
7+
package p
8+
9+
var _ = (new)(int)

0 commit comments

Comments
 (0)