[Mono-bugs] [Bug 53250][Wis] New - checked flag throws System.OverflowException

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Fri, 23 Jan 2004 10:51:16 -0500 (EST)


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 rkumar@novell.com.

http://bugzilla.ximian.com/show_bug.cgi?id=53250

--- shadow/53250	2004-01-23 10:51:16.000000000 -0500
+++ shadow/53250.tmp.25467	2004-01-23 10:51:16.000000000 -0500
@@ -0,0 +1,63 @@
+Bug#: 53250
+Product: Mono/Runtime
+Version: unspecified
+OS: Red Hat 9.0
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: rkumar@novell.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: checked flag throws System.OverflowException
+
+Description of Problem:
+When I have checked code and a typecast from float to int, I get
+System.OverflowException.
+
+Steps to reproduce the problem:
+1. Compile and run the following code,
+
+=================
+using System;
+
+public class Test {
+                                                                          
+     
+   public static void Main ()
+    {
+        int x; 
+        float f = 1.1f;
+        checked
+        {
+            x = (int) f;
+        }
+         Console.WriteLine ("x = " + x);
+    }
+}
+
+Actual Results:
+Throws System.OverflowException.
+[ravi@ravi System.Drawing]$ mono --debug TestSizeF.exe
+ 
+Unhandled Exception: System.OverflowException: Number overflow
+in (unmanaged) /opt/mono/lib/libmono.so.0(mono_raise_exception+0x1b)
+[0x4008042b]
+in (unmanaged) /opt/mono/lib/libmono.so.0 [0x400316bd]
+in [0x00007] (at
+/home/ravi/MONO/src/mcs/class/System.Drawing/Test/System.Drawing/TestSizeF.cs)
+MonoTests.System.Drawing.TestSizeF:Main ()
+
+Expected Results:
+It should print: x = 1
+
+How often does this happen? 
+Always.
+
+Additional Information:
+Same exe runs fine on .NET.