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

ensure sub-bitfield bits are always defined [NFC] #49471

Merged
merged 1 commit into from
Apr 24, 2023
Merged

Conversation

vtjnash
Copy link
Member

@vtjnash vtjnash commented Apr 24, 2023

Helps avoid UB or inconsistencies between Julia and C definitions.

Helps avoid UB or inconsistencies between Julia and C definitions.
@gbaraldi
Copy link
Member

Why are we adding the padding in the taggedvalue_bits if we don't set them?(I know setting them would be incorrect) but I thought that union would be fine here.

@vtjnash
Copy link
Member Author

vtjnash commented Apr 24, 2023

Adding padding forces C to consider them preserved after changing the other bits. It doesn't seem like the compiler usually bothers to corrupt them, but the bits were technically undefined after changing them because they are in the union.

@gbaraldi
Copy link
Member

Ok, then LGTM

@vtjnash vtjnash merged commit 2180db1 into master Apr 24, 2023
@vtjnash vtjnash deleted the jn/avoid-ub-bits branch April 24, 2023 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants