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 [EMAIL PROTECTED] http://bugzilla.ximian.com/show_bug.cgi?id=79087 --- shadow/79087 2006-08-16 14:54:01.000000000 -0400 +++ shadow/79087.tmp.17356 2006-08-16 14:54:01.000000000 -0400 @@ -0,0 +1,83 @@ +Bug#: 79087 +Product: Mono: Runtime +Version: 1.1 +OS: GNU/Linux [Other] +OS Details: Ubuntu 6.06 +Status: NEW +Resolution: +Severity: +Priority: Wishlist +Component: JIT +AssignedTo: [EMAIL PROTECTED] +ReportedBy: [EMAIL PROTECTED] +QAContact: [EMAIL PROTECTED] +TargetMilestone: --- +URL: +Cc: +Summary: Right shift of UInt64 incorrect for certain values + +Description of Problem: + +Attempting to right shift by 32 bits any UInt64 value with +most-significant-bit set (e.g. ulong.MaxValue in C#). + +Problem does NOT occur if the shift size of 32 is known at compile-time, as +the code generation seems to be handled differently in that case. + +I have confirmed this against very recent SVN source (63800). + +Here is a short C# program that can reproduce the problem; + +---- ShortTest.cs ---- +using System; +namespace ShortTest +{ + class MainClass + { + public static void Main(string[] args) + { + ulong ur = ulong.Parse(args[0], +System.Globalization.NumberStyles.HexNumber); + int shift = int.Parse(args[1]); + Console.WriteLine((ur >> shift).ToString("X")); + } + } +} +---------------------- + +To reproduce the bug, try e.g.; + + > mcs ShortTest.cs + > mono ShortTest.exe ffffffffffffffff 32 + +Actual Results: + +The above example prints the answer 1FFFFFFFF + +Expected Results: + +The answer should be FFFFFFFF + +How often does this happen? + +Consistently for UInt64 with most-significant-bit set, right shift of 32 +(dynamically determined) + + +Additional Information: + +I include a patch to mini-x86.c which seems like a fix to me; + +Index: mini-x86.c +=================================================================== +--- mini-x86.c (revision 63800) ++++ mini-x86.c (working copy) +@@ -2053,7 +2053,7 @@ + + /* handle shifts over 31 bits */ + x86_mov_reg_reg (code, ins->sreg1, ins->unused, 4); +- x86_shift_reg_imm (code, X86_SHR, ins->unused, 31); ++ x86_clear_reg (code, ins->unused); + + x86_patch (jump_to_end, code); + } _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
