[Mono-bugs] [Bug 43639][Nor] New - Possible conversion bug associated with Int64.
bugzilla-daemon@rocky.ximian.com
bugzilla-daemon@rocky.ximian.com
Sun, 25 May 2003 15:56:48 -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 jimeno@servidor.unam.mx.
http://bugzilla.ximian.com/show_bug.cgi?id=43639
--- shadow/43639 Sun May 25 15:56:48 2003
+++ shadow/43639.tmp.32150 Sun May 25 15:56:48 2003
@@ -0,0 +1,88 @@
+Bug#: 43639
+Product: Mono/Class Libraries
+Version: unspecified
+OS: Red Hat 9.0
+OS Details: Mono C# compiler version 0.24.0.0
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: System
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: jimeno@servidor.unam.mx
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Possible conversion bug associated with Int64.
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+
+ Apparently either Int64 or ToInt64 aren't correctly raising the
+OverflowException.
+
+Steps to reproduce the problem:
+1.
+
+ Compile the source code included at the end of this message.
+
+2.
+
+ Run the resulting executable.
+
+3.
+
+ Observe how the second conversion overflowed without raising the
+correspondant exeption.
+
+Actual Results:
+
+ The second conversion is wrong.
+
+Expected Results:
+
+ The second conversion would have shown a sequence of nines (and
+nines only).
+
+How often does this happen?
+
+ Every time.
+
+Additional Information:
+
+// int64-conv-bug.cs (source code)
+/*
+[jimeno@chiquis]$ mono int64conv-bug.exe
+999999999999999999=999999999999999999
+9999999999999999999=-8446744073709551617
+*/
+
+using System;
+
+class principal
+{
+ static void convAndShow(string stringedNumber)
+ {
+ Int64 integer;
+ try {
+ integer = Convert.ToInt64(stringedNumber);
+ }
+ catch (OverflowException oe) {
+ Console.WriteLine("{0} Is too large to convert into an Int64",
+stringedNumber);
+ return;
+ }
+ Console.WriteLine("{0}={1}", stringedNumber, integer);
+ }
+
+ static void Main()
+ {
+ string large ="999999999999999999";
+ string larger="9999999999999999999";
+
+ convAndShow(large);
+ convAndShow(larger);
+ }
+}