|<< Back to previous view|
[PCC-384] Bug with bitshifting operation Created: 23/Dec/11 Updated: 24/Dec/11
|Reporter:||D C Gosnell||Assignee:||Anders Magnusson|
Linux 2.6.31-21-generic-pae #59-Ubuntu SMP Wed Mar 24 08:47:55 UTC 2010 i686 GNU/Linux
pcc compiled with gcc 4.4.1
The following program produces the output "IT'S 2", when I would expect "IT'S 0"
int g = 0, b = 0, s = 0;
long l = (g/2) | ((b/2)<<s);
printf("IT'S %lx\n", l);
|Comment by D C Gosnell [ 23/Dec/11 03:51 PM ]|
I should have added the pcc version, which is :-
pcc 1.1.0.DEVEL 20111214 for i686-pc-linux-gnu
|Comment by Anders Magnusson [ 23/Dec/11 05:37 PM ]|
|Yetch, this simple code fails on amd64 also. Hm...|
|Comment by Anders Magnusson [ 24/Dec/11 12:03 PM ]|
Fixed now, thanks for a good bug report!
The problem was that when an instruction with special needs (like left shift on i386 which requires the shift count in cl) but no explicit result register the register assigned by the register allocator was ignored.