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

gccrs: ensure packed and aligned is applied properly #3272

Merged
merged 1 commit into from
Nov 27, 2024
Merged

Conversation

philberty
Copy link
Member

We cannot apply aligned or packed after layout_type is called you need to set this up first then call it.

Fixes #3260

gcc/rust/ChangeLog:

* backend/rust-compile-type.cc (TyTyResolveCompile::visit): call lauout type directly
* rust-backend.h (struct_type): add optional layout parameter
(union_type): likewise
(fill_in_fields): likewise
* rust-gcc.cc (struct_type): likewise
(union_type): likewise
(fill_in_fields): only layout if we required

We cannot apply aligned or packed after layout_type is called you need
to set this up first then call it.

Fixes #3260

gcc/rust/ChangeLog:

	* backend/rust-compile-type.cc (TyTyResolveCompile::visit): call lauout type directly
	* rust-backend.h (struct_type): add optional layout parameter
	(union_type): likewise
	(fill_in_fields): likewise
	* rust-gcc.cc (struct_type): likewise
	(union_type): likewise
	(fill_in_fields): only layout if we required

Signed-off-by: Philip Herron <[email protected]>
@philberty philberty added this pull request to the merge queue Nov 27, 2024
Merged via the queue into master with commit 7bdbcb7 Nov 27, 2024
13 checks passed
Copy link
Member

@CohenArthur CohenArthur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@philberty philberty deleted the structs branch December 12, 2024 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

incorrect handling of [repr(packed)] and [repr(align(n)] struct attributes
2 participants