Skip to content

cmd/compile: internal compiler error: not lowered: v7, StructMake0 STRUCT #63433

Closed

Description

@johejo

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

Activity

  1. randall77 commented on Oct 7, 2023

    @randall77
    Contributor
  2. cuonglm commented on Oct 9, 2023

    @cuonglm
    Member

    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 ""
    }
    
  3. added
    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.
    on Oct 9, 2023
  4. added this to the Go1.22 milestone on Oct 9, 2023
  5. self-assigned this
    on Oct 10, 2023
  6. dr2chase commented on Oct 10, 2023

    @dr2chase
    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()
    }
    
  7. cuonglm commented on Oct 10, 2023

    @cuonglm
    Member

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

  8. gopherbot commented on Oct 10, 2023

    @gopherbot
    Contributor

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

  9. added a commit that references this issue on Oct 20, 2023
    12e0fb4
  10. locked and limited conversation to collaborators on Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.compiler/runtimeIssues related to the Go compiler and/or runtime.

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions