inlined memcpy/memset degradation in gcc 4.6 or later
Joseph S. Myers
joseph@codesourcery.com
Sat Oct 6 00:10:00 GMT 2012
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
joseph@codesourcery.com
More information about the Gcc
mailing list