Continued from bug 550, the error for out of range shifting is present now, but lacks line numbers for Shl and Shr, but ShrAssign and ShlAssign are in good shape. The test code: void main() { int i = 0; i >>= 33; i <<= 33; i = i >> 33; i = i << 33; } the results: /home/braddr/sandbox/d/bugs/550/bug550.d(5): Error: shift assign by 33 is outside the range 0..32 /home/braddr/sandbox/d/bugs/550/bug550.d(6): Error: shift assign by 33 is outside the range 0..32 Error: shift by 33 is outside the range 0..32
Don't forget about UShr: void main() { int i; i >>= 33; i <<= 33; i >>>= 33; i = i >> 33; i = i << 33; i = i >>> 33; }
The fix (tested with gdc which exhibits exactly the same bug): --- optimize.c 2007年10月20日 03:11:39.000000000 -0700 +++ optimize.c.orig 2007年10月20日 03:12:10.000000000 -0700 @@ -473,7 +473,7 @@ integer_t i2 = e->e2->toInteger(); d_uns64 sz = e->e1->type->size() * 8; if (i2 < 0 || i2 > sz) - { e->error("shift by %jd is outside the range 0..%zu", i2, sz); + { error("shift by %jd is outside the range 0..%zu", i2, sz); e->e2 = new IntegerExp(0); } if (e->e1->isConst() == 1) The new ouput, with Matti's version of the code: bug550.d:4: Error: shift assign by 33 is outside the range 0..32 bug550.d:5: Error: shift assign by 33 is outside the range 0..32 bug550.d:6: Error: shift assign by 33 is outside the range 0..32 bug550.d:7: Error: shift left by 33 exceeds 32 bug550.d:8: Error: shift left by 33 exceeds 32 bug550.d:9: Error: shift left by 33 exceeds 32
Fixed DMD1.032
Fixed dmd 1.032 and 2.016
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル