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 compiler error: not lowered: v7, StructMake0 STRUCT #63433

Closed
johejo opened this issue Oct 7, 2023 · 5 comments
Closed
Assignees
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@johejo
Copy link

johejo 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?

no

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

go env Output
$ go env
GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/mitsuoheijo/.cache/go-build'
GOENV='/home/mitsuoheijo/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/mitsuoheijo/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/mitsuoheijo/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/home/mitsuoheijo/repos/github.com/golang/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/home/mitsuoheijo/repos/github.com/golang/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='devel go1.22-6e8caefc19 Fri Oct 6 22:31:47 2023 +0000'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/home/mitsuoheijo/repos/github.com/johejo/sandbox/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build2619123746=/tmp/go-build -gno-record-gcc-switches'

What did you do?

https://go.dev/play/p/YE9SPKldInU?v=gotip

package main

import "strings"

type windowsRenderer struct {
	WindowsRenderer
}

type WindowsRenderer struct{}

const (
	WindowsSeparator = '\\'
)

func (ur WindowsRenderer) Join(path ...string) string {
	return Join(WindowsSeparator, ur.VolumeName, path...)
}

func (WindowsRenderer) VolumeName(path string) string {
	return ""
}

func Join(sep uint8, volumeName func(string) string, elem ...string) string {
	for i, e := range elem {
		if e != "" {
			return Clean(sep, volumeName, strings.Join(elem[i:], string(sep)))
		}
	}
	return ""
}

func Clean(sep uint8, volumeName func(string) string, path string) string {
	return ""
}

func main() {}

This reproduction was extracted from github.com/juju/utils/v3/shell.
https://github.com/juju/utils/tree/v3.0.2/shell

What did you expect to see?

build succeeds

What did you see instead?

<autogenerated>:1: internal compiler error: 'windowsRenderer.Join': not lowered: v7, StructMake0 STRUCT

goroutine 6 [running]:
runtime/debug.Stack()
        ../../golang/go/src/runtime/debug/stack.go:24 +0x5e
cmd/compile/internal/base.FatalfAt({0xbbb48?, 0xc0?}, {0xc0000bbb00, 0x8}, {0xc00007c220?, 0x2, 0x2})
        ../../golang/go/src/cmd/compile/internal/base/print.go:225 +0x1d8
cmd/compile/internal/base.Fatalf(...)
        ../../golang/go/src/cmd/compile/internal/base/print.go:194
cmd/compile/internal/ssagen.(*ssafn).Fatalf(0x7f8979004898?, {0x10?, 0x0?}, {0xda932b, 0x2}, {0xc000036220?, 0x1, 0x0?})
        ../../golang/go/src/cmd/compile/internal/ssagen/ssa.go:8241 +0x171
cmd/compile/internal/ssa.(*Func).Fatalf(0xc000007520, {0xda932b, 0x2}, {0xc000036220?, 0x1, 0x1})
        ../../golang/go/src/cmd/compile/internal/ssa/func.go:742 +0x27b
cmd/compile/internal/ssa.checkLower(0xc000007520)
        ../../golang/go/src/cmd/compile/internal/ssa/lower.go:49 +0x405
cmd/compile/internal/ssa.Compile(0xc000007520)
        ../../golang/go/src/cmd/compile/internal/ssa/compile.go:97 +0xa15
cmd/compile/internal/ssagen.buildssa(0xc000463c20, 0x1)
        ../../golang/go/src/cmd/compile/internal/ssagen/ssa.go:599 +0x2336
cmd/compile/internal/ssagen.Compile(0xc000463c20, 0x1)
        ../../golang/go/src/cmd/compile/internal/ssagen/pgen.go:216 +0x45
cmd/compile/internal/gc.compileFunctions.func5.1(0x0?)
        ../../golang/go/src/cmd/compile/internal/gc/compile.go:182 +0x34
cmd/compile/internal/gc.compileFunctions.func3.1()
        ../../golang/go/src/cmd/compile/internal/gc/compile.go:164 +0x30
created by cmd/compile/internal/gc.compileFunctions.func3 in goroutine 20
        ../../golang/go/src/cmd/compile/internal/gc/compile.go:163 +0x247

bisected
b72bbae

@randall77
Copy link
Contributor

@dr2chase

@cuonglm
Copy link
Member

cuonglm commented Oct 9, 2023

A simple reproducer:

package p

type windowsRenderer struct {
	WindowsRenderer
}

type WindowsRenderer struct{}

func (ur WindowsRenderer) Join(path ...string) string {
	return Join('\\', ur.VolumeName, path...)
}

func (WindowsRenderer) VolumeName(path string) string {
	return ""
}

func Join(sep uint8, volumeName func(string) string, elem ...string) string {
	for i, e := range elem {
		if e != "" {
			return Clean(sep, volumeName, join(elem[i:], string(sep)))
		}
	}
	return ""
}

func Clean(sep uint8, volumeName func(string) string, path string) string {
	return ""
}

//go:noinline
func join(elems []string, sep string) string {
	return ""
}

@dmitshur dmitshur added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Oct 9, 2023
@dmitshur dmitshur added this to the Go1.22 milestone Oct 9, 2023
@dmitshur dmitshur added the compiler/runtime Issues related to the Go compiler and/or runtime. label Oct 9, 2023
@dr2chase dr2chase self-assigned this Oct 10, 2023
@dr2chase
Copy link
Contributor

Ugh, how did I not see the mention?
Shorter reproducer:

package main

type ResourceFunc struct {
	junk [8]int
	base assignmentBaseResource
}

type SubscriptionAssignmentResource struct {
	base assignmentBaseResource
}

type assignmentBaseResource struct{}

//go:noinline
func (a assignmentBaseResource) f(s string) ResourceFunc {
	println(s)
	return ResourceFunc{}
}

//go:noinline
func (r SubscriptionAssignmentResource) Hi() ResourceFunc {
	rf := r.base.f("Hello world")
	rf.base = r.base
	return rf
}

func main() {
	var r SubscriptionAssignmentResource
	r.Hi()
}

@cuonglm
Copy link
Member

cuonglm commented Oct 10, 2023

@dr2chase Seems that we missed the helper for cleaning up SelectStruct with MakeStruct0 argument?

@gopherbot
Copy link

Change https://go.dev/cl/534296 mentions this issue: cmd/compile: get rid of zero-sized values in call expansion

yunginnanet pushed a commit to yunginnanet/go that referenced this issue Oct 20, 2023
Do this by removing all stores of zero-sized anything.

Fixes golang#63433.

Change-Id: I5d8271edab992d15d02005fa3fe31835f2eff8fa
Reviewed-on: https://go-review.googlesource.com/c/go/+/534296
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

6 participants