https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96293
--- Comment #9 from Long Deng <ldeng at mail dot ustc.edu.cn> --- I take your point, although there seems to be a slight problem with your example. In your code, `&a->record.data[0]` is not a well-aligned access, because `struct attribute` is defined as packed, so compiler has no any information about where `a` itself is aligned to. `a` could start at any address so `a->record.data` might not well-aligned. Maybe a better example is defining `struct record` as `((packed))` and `struct attribute` as `((packed, aligned(2))`, which ensure `a` is well-aligned. Even in this case, gcc still issue the warning. Full example: ``` #include <stdio.h> #include <stddef.h> #include <stdint.h> #include <assert.h> struct Unaligned { uint8_t b; uint32_t c; uint16_t d; }__attribute__((packed)); struct Aligned { uint8_t d; struct Unaligned u; }__attribute__((packed, aligned(8))); static_assert(sizeof(struct Aligned) == 8); void fun(uint16_t* addr) { *addr = 1234; } int main() { struct Aligned a; printf("addr of a: %p\n", &a); printf("offsetof d: %zu\n",offsetof(struct Aligned, u.d)); fun(&a.u.d); return 0; } ```