qemu-trivial
[Top][All Lists]
Advanced

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

Re: [Qemu-trivial] [Qemu-devel] [PATCH] vnc: Fix packed boolean struct m


From: Paolo Bonzini
Subject: Re: [Qemu-trivial] [Qemu-devel] [PATCH] vnc: Fix packed boolean struct members
Date: Thu, 08 Mar 2012 19:07:31 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.1) Gecko/20120216 Thunderbird/10.0.1

Il 08/03/2012 17:25, Anthony Liguori ha scritto:
>>
>> Looks like a GCC bug where
>>
>>     x = y = 0;
>>
>> is converted to
>>
>>     x = (y = 0) != 0;
> 
> Curious, why convert like this?  What does this optimization do?

Nothing, it's just that if "y = 0" is an int (for some reason, I didn't
check if it's implicit promotion or just that y is already an int), then
it has to be converted back to a truth value before assigning to bool.
If you do

  bool x;
  int y;

  x = y = 2;

x is actually set to 1.

Paolo



reply via email to

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