[Mono-bugs] [Bug 74597][Maj] Changed - bitwise shift on negative values is incorrectly computed
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Tue, 19 Apr 2005 11:10:39 -0400 (EDT)
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by rharinath@novell.com.
http://bugzilla.ximian.com/show_bug.cgi?id=74597
--- shadow/74597 2005-04-16 15:50:04.000000000 -0400
+++ shadow/74597.tmp.27422 2005-04-19 11:10:39.000000000 -0400
@@ -1,13 +1,13 @@
Bug#: 74597
Product: Mono: Compilers
Version: 1.0
OS: unknown
OS Details: mono 1.1.6
-Status: NEW
-Resolution:
+Status: RESOLVED
+Resolution: NOTABUG
Severity: Unknown
Priority: Major
Component: C#
AssignedTo: rharinath@novell.com
ReportedBy: nazgul@omega.pl
QAContact: mono-bugs@ximian.com
@@ -56,6 +56,24 @@
* 4 When the type of x is long or ulong, the shift count is given by
the low-order six bits of count. 5 In other words, the shift count is
computed from count & 0x3F
from
http://www.jaggersoft.com/csharp_standard/14.8.htm
+
+------- Additional Comments From rharinath@novell.com 2005-04-19 11:10 -------
+The lower order 5 bits of -3 are '11101' == 29. Since -100 is
+negative, it performs an arithmetic shift, i.e., sign extension. So,
+-1 seems to be right.
+
+Since the standard specifically requires sign extension, I don't see
+how a negative number can be shifted to obtain a non-negative (apart
+from casting it to uint, of course).
+
+Anyway, the following code gave -1 on CSC 2.0beta1
+
+ class X {
+ static int x = -100; static int count = -3;
+ static void Main () { System.Console.WriteLine (x >> count); }
+ }
+
+So, NOTABUG