We need an '__unaligned' modifier for pointers to specify that the pointer will be used for unaligned reads and writes.
struct foo { int x; };
struct bar { __attribute__((packed)) int x; };
_Static_assert(_Alignof(struct foo) == 4, "");
_Static_assert(_Alignof(struct bar) == 1, "");The standard, you may say.. I would argue it's the standard need to be changed. The modern reading of the standard is not useful as a low-level language and is unsafe as a high-level language.
If I'm reading your comment and the blog post correctly, the compiler would need a memory like access on every multibyte pointer argument where the compiler cannot otherwise prove alignment. Is that correct?
Though it seems that, independent of this, it assumes that an int* in general will be 4-byte-aligned, so e.g. https://godbolt.org/z/aWTEd4s3K still has an "align 4" despite using memcpy. So one must also cast to a char* before using memcpy() to actually have it work. yay for more footguns!
I meant memcpy()-like