https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96293

--- Comment #6 from Long Deng <ldeng at mail dot ustc.edu.cn> ---
I met the same problem. I found that gcc issue this warning probably because
`struct S` can located any address, which means that `s.d` may not alignment to
4.
So as Richard said, you can use `__attribute__((packed, aligned(4))` to get rid
of this warning, it still guaranteed that you struct is packed (i.e. `sizeof(S)
== 8`), and struct itself will alignment to 4, so `s.d` will aligns correctly.

Reply via email to