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

-Waddress-of-packed-member flags attribute(packed) but not pragma pack #97091

Open
davidben opened this issue Jun 28, 2024 · 0 comments
Open
Labels
clang:diagnostics New/improved warning or error message in Clang, but not in clang-tidy or static analyzer confirmed Verified by a second party false-negative

Comments

@davidben
Copy link
Contributor

In this example, there are two packed (and thus unaligned) structs, both of whom have an int field where taking the address is dangerous, as I understand it:
https://godbolt.org/z/PdqaMoeof

But for some reason, -Waddress-of-packed-member only flags the first one, and not the second. Is that intentional? I think they both run afoul of pointer alignment requirements. I noticed #23195 was filed back in 2016, but it was closed on grounds that Clang doesn't accept #pragma pack.

It seems Clang now does, but the warning was never updated?

@EugeneZelenko EugeneZelenko added clang:diagnostics New/improved warning or error message in Clang, but not in clang-tidy or static analyzer false-negative and removed new issue labels Jun 28, 2024
@AaronBallman AaronBallman added the confirmed Verified by a second party label Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:diagnostics New/improved warning or error message in Clang, but not in clang-tidy or static analyzer confirmed Verified by a second party false-negative
Projects
None yet
Development

No branches or pull requests

3 participants