From: Stuart B. <zu...@us...> - 2007-04-20 15:08:09
|
Update of /cvsroot/hppaqemu/hppaqemu/target-hppa In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv6479 Modified Files: op.c Log Message: Avoid undefined behaviour of 32-bit left shifts in op_shrpw_cc(), based on a patch by Tomonori Yamane. Index: op.c =================================================================== RCS file: /cvsroot/hppaqemu/hppaqemu/target-hppa/op.c,v retrieving revision 1.30 retrieving revision 1.31 diff -u -d -r1.30 -r1.31 --- op.c 20 Apr 2007 14:53:06 -0000 1.30 +++ op.c 20 Apr 2007 15:08:05 -0000 1.31 @@ -701,7 +701,12 @@ /* INPUT: T0 = shift amount, T1 and T2 = register pair values */ /* OUTPUT: T0 */ T0 &= 0x1f; - T0 = (T1 << (32 - T0)) | (T2 >> T0); + + if (T0 == 0) + T0 = T2; /* avoid "<< 32" with undefined result */ + else + T0 = (T1 << (32 - T0)) | (T2 >> T0); + FORCE_RET(); } void OPPROTO op_extrw_cc(void) |