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

sync/atomic: allow linked lists of atomic.Pointer [1.19 backport] #57124

Closed
prattmic opened this issue Dec 6, 2022 · 2 comments
Closed

sync/atomic: allow linked lists of atomic.Pointer [1.19 backport] #57124

prattmic opened this issue Dec 6, 2022 · 2 comments
Assignees
Labels
CherryPickApproved Used during the release process for point releases compiler/runtime Issues related to the Go compiler and/or runtime. FrozenDueToAge release-blocker
Milestone

Comments

@prattmic
Copy link
Member

prattmic commented Dec 6, 2022

#56638 backported https://go.dev/cl/448275 as https://go.dev/cl/448518, which was released in Go 1.19.4.

This CL introduced a regression breaking compilation of atomic.Pointer[T] fields in T (such as linked list next pointers).

This regression is fixed in https://go.dev/cl/450655, sent as a backport in https://go.dev/cl/452438.

This backport did not make it into 1.19.4, so it should go into 1.19.5.

@prattmic prattmic added the CherryPickCandidate Used during the release process for point releases label Dec 6, 2022
@prattmic prattmic added this to the Go1.19.5 milestone Dec 6, 2022
@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Dec 6, 2022
@gopherbot
Copy link

Change https://go.dev/cl/452438 mentions this issue: [release-branch.go1.19] sync/atomic: allow linked list of atomic pointers again

@prattmic prattmic added the CherryPickApproved Used during the release process for point releases label Dec 7, 2022
@gopherbot gopherbot removed the CherryPickCandidate Used during the release process for point releases label Dec 7, 2022
@gopherbot
Copy link

Closed by merging df5d4d3 to release-branch.go1.19.

gopherbot pushed a commit that referenced this issue Dec 9, 2022
…ters again

For #56603, CL 448275 added a _ [0]T field to atomic.Pointer,
so that different kinds of atomic.Pointer are not convertible.

Unfortunately, that breaks code like:

	type List struct {
		Next atomic.Pointer[List]
	}

which should be valid, just as using Next *List is valid.
Instead, we get:

	./atomic_test.go:2533:6: invalid recursive type List
		./atomic_test.go:2533:6: List refers to
		./atomic_test.go:2534:13: "sync/atomic".Pointer refers to
		./atomic_test.go:2533:6: List

Fix by using _[0]*T instead.

For #56638.
Fixes #57124.

Change-Id: Icc4c83c691d35961d20cb14b824223d6c779ac5e
Reviewed-on: https://go-review.googlesource.com/c/go/+/450655
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
(cherry picked from commit b14cf3d)
Reviewed-on: https://go-review.googlesource.com/c/go/+/452438
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
@golang golang locked and limited conversation to collaborators Dec 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CherryPickApproved Used during the release process for point releases compiler/runtime Issues related to the Go compiler and/or runtime. FrozenDueToAge release-blocker
Projects
None yet
Development

No branches or pull requests

4 participants