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/cgo: alignment issue with int128 inside of a struct [1.22 backport] #69218

Closed
gopherbot opened this issue Sep 3, 2024 · 2 comments
Closed
Labels
CherryPickApproved Used during the release process for point releases compiler/runtime Issues related to the Go compiler and/or runtime.
Milestone

Comments

@gopherbot
Copy link
Contributor

@ianlancetaylor requested issue #69086 to be considered for backport to the next 1.22 minor release.

@gopherbot Please backport this issue.

This never worked so it is not a regression. But it seems worth fixing because without it it's quite hard to use a C struct with an int128 field.

@gopherbot gopherbot added the CherryPickCandidate Used during the release process for point releases label Sep 3, 2024
@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Sep 3, 2024
@gopherbot gopherbot added this to the Go1.22.7 milestone Sep 3, 2024
@dmitshur dmitshur added CherryPickApproved Used during the release process for point releases and removed CherryPickCandidate Used during the release process for point releases labels Sep 4, 2024
@gopherbot gopherbot modified the milestones: Go1.22.7, Go1.22.8 Sep 5, 2024
@gopherbot
Copy link
Contributor Author

Change https://go.dev/cl/611297 mentions this issue: [release-branch.go1.22] cmd/cgo: correct padding required by alignment

gopherbot pushed a commit that referenced this issue Sep 5, 2024
If the aligned offset isn't sufficient for the field offset,
we were padding based on the aligned offset. We need to pad
based on the original offset instead.

Also set the Go alignment correctly for int128. We were defaulting
to the maximum alignment, but since we translate int128 into an
array of uint8 the correct Go alignment is 1.

For #69086
Fixes #69218

Change-Id: I23ce583335c81beac2ac51f7f9336ac97ccebf09
Reviewed-on: https://go-review.googlesource.com/c/go/+/608815
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
(cherry picked from commit c209892)
Reviewed-on: https://go-review.googlesource.com/c/go/+/611297
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
@gopherbot
Copy link
Contributor Author

Closed by merging CL 611297 (commit 71655f1) to release-branch.go1.22.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CherryPickApproved Used during the release process for point releases compiler/runtime Issues related to the Go compiler and/or runtime.
Projects
None yet
Development

No branches or pull requests

3 participants
@dmitshur @gopherbot and others