Skip to content

Conversation

ibuclaw
Copy link
Member

@ibuclaw ibuclaw commented Aug 12, 2025

No description provided.

@ibuclaw ibuclaw added Feature:ImportC Pertaining to ImportC support Feature: bitfields labels Aug 12, 2025
@dlang-bot
Copy link
Contributor

Thanks for your pull request, @ibuclaw!

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

⚠️⚠️⚠️ Warnings ⚠️⚠️⚠️

  • In preparation for migrating from Bugzilla to GitHub Issues, the issue reference syntax has changed. Please add the word "Bugzilla" to issue references. For example, Fix Bugzilla Issue 12345 or Fix Bugzilla 12345.(Reminder: the edit needs to be done in the Git commit message, not the GitHub pull request.)

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub run digger -- build "master + dmd#21710"

@ibuclaw ibuclaw force-pushed the issue18238 branch 2 times, most recently from 8ae188f to 5720704 Compare August 12, 2025 20:35
long x : 8;
}

version (Windows)
Copy link
Member Author

Choose a reason for hiding this comment

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

Probably need a better way to detect toggling -mms-bitfields on x86 targets.

import imports.imp18238;

align(1) // align means packed
struct I18238
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, that's IMO suprising. The outer aggregate alignment usually doesn't affect the fields layout at all, just removes any tail padding.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh well, I guess the remaining 56 bits are treated as tail padding, so probably fine.

Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe, I'll have to have a look again at the state of the alignment struct, whether or not packed is set true.

Copy link
Member Author

Choose a reason for hiding this comment

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

OK, I think I have it now. packed and eg aligned(2) were interfering with each other.

What we were left with was {packed=true, value=1} or {packed=false, value=2}. Instead we want {packed=true, value=2} when both attributes are present.

Copy link
Member Author

Choose a reason for hiding this comment

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

Now its D not respecting natural alignment.

@ibuclaw ibuclaw force-pushed the issue18238 branch 2 times, most recently from 3c432b2 to 3d276de Compare August 13, 2025 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature: bitfields Feature:ImportC Pertaining to ImportC support
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants