Bugzilla – Bug 324523
checked fails to detect integer overflow
Last modified: 2007-09-15 21:24:23 UTC
---- Reported by zerberous@googlemail.com 2007-06-10 11:07:33 MST ---- Description of Problem: checked fails with integer overflow. Steps to reproduce the problem: Create project gtk, in mono-develop, enter following app: --------------------------------- // project created on 6/9/2007 at 10:51 PM using System; using Gtk; namespace test2 { class MainClass { public static void Main (string[] args) { checked { int i=int.MaxValue; i=+10000; Console.Write("not catched : " + i + "\n"); } checked { int i=int.MaxValue; i=i+10000; Console.Write("catched : " + i + "\n"); } Application.Init (); MainWindow win = new MainWindow (); win.Show (); Application.Run (); } } } --------------------------------- Actual Results: not catched : 10000 catched : -2147473649 Expected Results: an overflow exception How often does this happen? always Additional Information: debug target in mono-develop selected ---- Additional Comments From zerberous@googlemail.com 2007-06-10 13:56:07 MST ---- misinterpreted i=+10000; for i+=10000; mono is just fine. Unknown bug field "cf_op_sys_details" encountered while moving bug <cf_op_sys_details>2.6.20-16-generic #2 SMP - ubuntu feisty</cf_op_sys_details> Unknown operating system unknown. Setting to default OS "Other".