COPY_TWO_BYTES and C strict aliasing
From: Philip Martin <philip.martin_at_wandisco.com>
Date: Fri, 01 Jun 2012 13:22:35 +0100
GCC gives a compiler warning where the COPY_TWO_BYTES macro is used. A
../src/subversion/libsvn_subr/string.c:971:11: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
The code is:
/* Copy the two bytes at SOURCE[0] and SOURCE[1] to DEST[0] and DEST[1] */
apr_size_t
/* Small numbers are by far the most common case.
Is the warning something we can ignore? My understanding of C aliasing
Is COPY_TWO_BYTES a significant optimisation? On Linux we can avoid the
memcpy(dest, source, 2)
since that memcpy call will be inlined these days.
-- uberSVN: Apache Subversion Made Easy http://www.uberSVN.comReceived on 2012-06-01 14:23:16 CEST |
This is an archived mail posted to the Subversion Dev mailing list.
This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.