Re: No warning for unreachable code

2008-06-06 Thread Segher Boessenkool
I'm suggesting that there's no big difference between unsigned char and unsigned int (and unsigned long...) in this case, and, therefore compiler's behaviour should be consistent. But there is a difference. When "x" is an unsigned int, the expression "x < 0" is equivalent to (unsigned i

Re: No warning for unreachable code

2008-06-03 Thread Guennadi Liakhovetski
Hi Segher, On Wed, 4 Jun 2008, Segher Boessenkool wrote: > > I just discovered a behaviour in gcc-4, which I don't understand: code > > > > unsigned int x; > > > > if (x < 0) > > do_something(); > > > > compiled with -Wall doesn't produce a warning, and the call to > > do_s

Re: No warning for unreachable code

2008-06-03 Thread Segher Boessenkool
I just discovered a behaviour in gcc-4, which I don't understand: code unsigned int x; if (x < 0) do_something(); compiled with -Wall doesn't produce a warning, and the call to do_something() is silently dropped, whereas if x is of type unsigned char, I get as

No warning for unreachable code

2008-06-03 Thread Guennadi Liakhovetski
I just discovered a behaviour in gcc-4, which I don't understand: code unsigned int x; if (x < 0) do_something(); compiled with -Wall doesn't produce a warning, and the call to do_something() is silently dropped, whereas if x is of type unsigned char, I get as e