On Sun, 4 Mar 2001, Mariano Alvarez Fernandez wrote:
Nevertheless the real bug is that: 1L << 32 == 1 !!!!!! This is what breaks bccbgi (and even modetest) in 32 bpp mode.
Yes, strange. Andris, is this a compiler bug or just undefined behaviour ?
compiling the following source using gcc -O3 -fomit-grame-pointer (gcc2.7.2.3) ------------------------------- extern int si; extern unsigned ui; extern long li; extern unsigned long ul;
void foo(void) { si <<= 32; ui <<= 32; li <<= 32; ul <<= 32; }
void foo2(void) { si = 1; si <<= 32; ui = 1; ui <<= 32; li = 1; li <<= 32; ul = 1; ul <<= 32; } ------------------------------- gives some warnings ------------------------------- test_shift.c: In function `foo': test_shift.c:8: warning: left shift count >= width of type test_shift.c:9: warning: left shift count >= width of type test_shift.c:10: warning: left shift count >= width of type test_shift.c:11: warning: left shift count >= width of type test_shift.c: In function `foo2': test_shift.c:16: warning: left shift count >= width of type test_shift.c:17: warning: left shift count >= width of type test_shift.c:18: warning: left shift count >= width of type test_shift.c:19: warning: left shift count >= width of type ------------------------------- and the following assembly code ------------------------------- foo: movl $0,si movl $0,ui movl $0,li movl $0,ul ret [...] foo2: movl $1,si movl $1,ui movl $1,li movl $1,ul ret -------------------------------
I would have expected the foo() in both cases. It shouldnŽt make any difference if ŽuiŽ unknown or known to be 1 ... Can yhou please check other GCC versions. I would expect gcc 3.0 to behave at least consistent here.
On Mon, 05 Mar 2001, Andris Pavenis wrote:
If I'm applying following patch additionally to Hartmut's one xbccbgi begins to work (with some problems though, but not more than with 16bpp mode under XFree86) with 32bpp for me
Good.