This is undefined behavior under C99 §6.3.2.3 Paragraph 7. "If the resulting pointer is not correctly aligned for the pointed-to type, the behavior is undefined."
The musl code referenced has handling for this.
I’m curious about what the referenced code compiles down to, actually, because not only could GCC be auto-vectorizing it, it could be replacing it with a REP STOSQ or indeed a call to memset.
gcc: https://godbolt.org/z/6xG5dKjj9
clang: https://godbolt.org/z/Mh9zozjvK
I'm no asm expert, but it doesn't look like a lot of vector instructions in the gcc compilation of this, while the clang compilation seems to have more calls with the 128-bit xmm registers (at least on x86_64.) You can also just see visibly how many more instructions the gcc version outputs.
That used to be stable stakes for this kind of thing, but maybe it doesn’t matter much anymore?