[Mono-bugs] [Bug 27375][Wis] New - checked() does not throw OverflowException
bugzilla-daemon@rocky.ximian.com
bugzilla-daemon@rocky.ximian.com
3 Jul 2002 13:05:29 -0000
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 ndrochak@gol.com.
http://bugzilla.ximian.com/show_bug.cgi?id=27375
--- shadow/27375 Wed Jul 3 09:05:29 2002
+++ shadow/27375.tmp.23563 Wed Jul 3 09:05:29 2002
@@ -0,0 +1,45 @@
+Bug#: 27375
+Product: Mono/Runtime
+Version: unspecified
+OS: Red Hat 7.2
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Wishlist
+Component: misc
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: ndrochak@gol.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: checked() does not throw OverflowException
+
+The following code (compiled with csc) should throw an OverflowException,
+which it does on ms.net. On mono it does not. It runs to the end and
+returns 1.
+
+---------------------------------------------------------------------
+
+using System;
+
+class Class1
+{
+ static int Main(string[] args)
+ {
+ string parse_me = "9999999999999999999999";
+ int len = parse_me.Length;
+ long val = 0;
+ char c;
+
+ for (int i = 0; i < len; i++){
+ c = parse_me [i];
+
+ if (c >= '0' && c <= '9'){
+ val = checked (val * 10 + (c - '0'));
+ }
+ }
+ return 1;
+ }
+}