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

#[repr(C)] not necessarily compatible with C #152

Open
bjorn3 opened this issue Jul 26, 2022 · 3 comments
Open

#[repr(C)] not necessarily compatible with C #152

bjorn3 opened this issue Jul 26, 2022 · 3 comments

Comments

@bjorn3
Copy link

bjorn3 commented Jul 26, 2022

https://spec.ferrocene.dev/types-and-traits.html#type-representation

It was discovered1 that for MSVC compilers certain cases around ZST's and packed structs have a different memory layout than what rustc does on every platform.

Footnotes

  1. https://github.com/rust-lang/rust/issues/81996

@Veykril
Copy link
Member

Veykril commented Aug 4, 2023

This is fine for the spec as this is considered a bug in the compiler

@Veykril Veykril closed this as completed Aug 4, 2023
@bjorn3
Copy link
Author

bjorn3 commented Aug 4, 2023

The algorithm that ferrocene specifies doesn't match what MSVC does. So either the bug is in MSVC or in the specification. If it is considered a bug in MSVC by microsoft, it may not be fixed in MSVC anyway for back compat reasons. And if it will be fixed, old dll's compiled before the fix may be ABI incompatible if they use a type like this.

@Veykril
Copy link
Member

Veykril commented Aug 4, 2023

I see, well it's not too relevant for us right now as windows won't be a target. But let's keep it open to track then

@Veykril Veykril reopened this Aug 4, 2023
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

No branches or pull requests

2 participants