https://gcc.gnu.org/bugzilla/show_bug.cgi?id=50417
--- Comment #9 from Oleg Endo <olegendo at gcc dot gnu.org> --- (In reply to rguent...@suse.de from comment #8) > > But there is no good reasoning that can be applied that it is a valid > transform. What does clang do when s is void * and you cast that to > uint32_t *? Note that memcpy prototype takes a void * argument. Does it matter whether there's a void* in between or not? If we do a *(int32_T*)(void*)(int32_t*)p on a strict alignment target, it will result in a 32 bit mem access. GCC knows memcpy and its semantics well enough so propagating the target's alignment rules into memcpy is most likely going to be a safe and sane thing to do. So at least cases like void test (const int* a, int* b) { std::memcpy (b, a, 4); } should work. Shouldn't it?