qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 1/2] target-i386: Use 1UL for bit shift


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH 1/2] target-i386: Use 1UL for bit shift
Date: Fri, 2 Oct 2015 10:48:43 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0


On 01/10/2015 20:40, Laszlo Ersek wrote:
> > Also strict aliasing improves performance noticeably at least on some
> > kind of code.  The relaxation of strict aliasing that GCC does with
> > unions would be a useful addition to the C standard, though.
>
> What do you mean under "relaxation of strict aliasing that GCC does with
> unions"? I believe I know how unions affect this (although for details
> I'd obviously have to consult the standard :)), but what are the gcc
> specific parts?

I remembered wrong---it's not a relaxation of strict aliasing, it's
defining what happens when a member of a union is accessed through a
member of a different type.  C89 makes that implementation-defined
(3.3.2.3) and GCC defines the behavior the sane way: "the relevant bytes
of the representation of the object are treated as an object of the type
used for the access".

C99 makes the other members "take unspecified values" (6.2.6.1).  I have
always thought this to be weaker than GCC's promise, but found out that
a subsequent TR added a footnote to clarify that the desired behavior is
the sane one too.  C11 also has the same footnote, and no other change
in this area.

Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]