https://gcc.gnu.org/bugzilla/show_bug.cgi?id=50417
--- Comment #18 from Georg-Johann Lay <gjl at gcc dot gnu.org> --- (In reply to rguent...@suse.de from comment #12) > On Fri, 8 Jul 2016, olegendo at gcc dot gnu.org wrote: > > > void test (const int *a, int *b) > > { > > a[100] = 1; > > b[200] = 2; > > > > std::memcpy ((char *)b, (char *)a, t); > > } > > > > where a[100] and b[200] both would result in 32 bit accesses, not 4x1 byte > > or > > something, because the base pointer is assumed to be int aligned. > > No, because the access is performed as 'int'. > > > Why should memcpy be any different? > > Because the memcpy stmt doesn't constitute a memory access but a function > call. What about a new command option like -fassume-aligned-xxx that's off per default? The user could assert that when she is using memcpy (and friends) with a pointer of a specific type, then that also asserts that the data behind the pointer is appropriately aligned and may be accessed accordingly.