-fno-strict-aliasing in CWARNFLAGS?

Michael Cree mcree at orcon.net.nz
Wed Feb 3 20:43:41 PST 2010


On 04/02/10 14:28, Soeren Sandmann wrote:
> Michael Cree<mcree at orcon.net.nz>  writes:
>
>> What I do see is that the variables a, r, g and b are essentially
>> declared unsigned char (what I presume uint8_t is typedefed to) and a
>> calculation is performed that will lose its intended result due to
>> shifting an unsigned char more bits to the left than is available in
>> the unsigned char.
>
> The variables are promoted to int before the shift takes place, so the
> code works fine, apart from the aliasing issue.

Yeah, I remembered that once I thought about it a bit more after hitting 
the send button...  oops :-/

I once knew all this stuff intimately; I could've even written out a 
complete operator precedence table from memory!  Having only programmed 
in C on occasion over the last 12 years I now realise that some of that 
knowledge is getting a little hazy.

While I unfortunately polluted the thread with my misguided ramblings I 
have nevertheless found this discussion very useful.

Cheers
Michael.


More information about the xorg-devel mailing list