This is the mail archive of the
mailing list for the GCC project.
Re: inlined memcpy/memset degradation in gcc 4.6 or later
On Fri, 5 Oct 2012, Joe Buck wrote:
> structure. The types of the pointers tell me the required alignment.
> If there is language in the standard indicating otherwise then the
> standard is defective, because it prevents an obvious optimization.
In the standard, given a sequence of pointer conversions you can assume
the highest alignment of any of the pointer types involved.
In practice, optimizations based on that caused problems, such as
miscompilations of glibc where various constants (part of the public ABI)
use unaligned values such as (int *) -1 and comparisons of pointers
against those constants got optimized to 0.
Joseph S. Myers