[ipxe-devel] [PATCH] Avoid strict-aliasing warning for gcc 4.3.

Michael Brown mbrown at fensystems.co.uk
Wed Mar 20 16:20:34 UTC 2013


On 20/03/13 08:34, Bo Yang wrote:
> Signed-off-by: Bo Yang<boyang at suse.com>
> ---
>   src/arch/i386/include/bits/byteswap.h |    4 ++--
>   1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/arch/i386/include/bits/byteswap.h b/src/arch/i386/include/bits/byteswap.h
> index f3d30a2..0d9cb96 100644
> --- a/src/arch/i386/include/bits/byteswap.h
> +++ b/src/arch/i386/include/bits/byteswap.h
> @@ -53,8 +53,8 @@ __bswap_variable_64 ( uint64_t x ) {
>   static inline __attribute__ (( always_inline )) void
>   __bswap_64s ( uint64_t *x ) {
>   	struct {
> -		uint32_t low;
> -		uint32_t high;
> +		uint32_t __attribute__ (( may_alias )) low;
> +		uint32_t __attribute__ (( may_alias )) high;
>   	} __attribute__ (( may_alias )) *dwords = ( ( void * ) x );
>   	uint32_t discard;

I'm puzzled by this; as far as I know, the may_alias which is already 
present on the structure type should be sufficient.  I have tested gcc 
versions 4.3.0, 4.3.1, 4.3.2, 4.3.3, 4.3.4 and 4.3.5 (using the GCC 
compile farm) and have not been able to reproduce any problem with the 
original, unmodified code.

Could you let me know precisely which gcc version is causing problems, 
and what the error message is?

Thanks,

Michael



More information about the ipxe-devel mailing list