On Fri, 23 Apr 2010 19:53:24 BST C H Forsyth <fors...@vitanuova.com>  wrote:
> >As per C89 in this case the unsigned char value should be
> >promoted to a *signed* int value.  The sum will be of type
> >signed int and so the division will do the right thing. In
> >kencc case it seems the sum has type unsigned int for some
> >reason and further, the signed divisor (2) is promoted to an
> >unsigned int. Seems like a bug.
> 
> on 19 April, I wrote:
> >notably the compiler doesn't implement the value-preserving rules for compar
> isons. ...
> >instead the compiler implements the older unsigned-preserving rule

Does the following assertion fail under plan9?

    int x = 1234, y = -4321;
    unsigned char z = 12;
    int r1, r2;

    r1 = (x + y + z)/2;

    x += z;
    r2 = (x + y)/2;
    
    assert(r1 == r2);

If so, I consider it a bug; particularly as there is no
overflow involved anywhere.

Reply via email to