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: valid go1.17 non-recursive program fails to compile with invalid recursive type error #59437

Closed
zeebo opened this issue Apr 4, 2023 · 1 comment
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. FrozenDueToAge

Comments

@zeebo
Copy link
Contributor

zeebo commented Apr 4, 2023

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

go1.18+

Does this issue reproduce with the latest release?

yes

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

linux/amd64 but presumably this is not architecture/os specific.

What did you do?

tried to compile this program: https://go.dev/play/p/9p5orAisxIh

package main

import (
	"unsafe"
)

type A struct {
	SomeInt  int
	Ptr      *B
	SomeBool bool
}

type B struct {
	A
	_           [64 - unsafe.Sizeof(A{})]byte // pad to cache line
	OtherFields int
	Whatever    string
}

func main() {}

What did you expect to see?

A successful compilation (as it does on go1.17).

What did you see instead?

./prog.go:15:34: invalid recursive type

@bcmills bcmills changed the title cmd/go: valid go1.17 non-recursive program fails to compile with invalid recursive type error cmd/compile: valid go1.17 non-recursive program fails to compile with invalid recursive type error Apr 4, 2023
@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Apr 4, 2023
@seankhliao
Copy link
Member

Duplicate of #14620

@seankhliao seankhliao marked this as a duplicate of #14620 Apr 4, 2023
@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Apr 4, 2023
@golang golang locked and limited conversation to collaborators Apr 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. FrozenDueToAge
Projects
None yet
Development

No branches or pull requests

3 participants