https://bugzilla.novell.com/show_bug.cgi?id=706877
https://bugzilla.novell.com/show_bug.cgi?id=706877#c0 Summary: Compiling with overflow checks enabled doesn't work Classification: Mono Product: Mono: Compilers Version: 2.10.x Platform: i686 OS/Version: Linux Status: NEW Severity: Major Priority: P5 - None Component: C# AssignedTo: michael.mil...@suse.com ReportedBy: martinho.fernan...@gmail.com QAContact: mono-bugs@lists.ximian.com Found By: --- Blocker: --- Description of Problem: When you compile a C# program with the gmcs flag -checked, no overflow checks are made at runtime. Steps to reproduce the problem: 1. Save the following program in a file a.cs: public class Bug { public static void Main() { long x = long.MaxValue; System.Console.WriteLine(x * 2); } } 2. Compile with: $ gmcs -checked a.cs 3. Run the resulting program: $ mono a.exe Actual Results: The program prints -2. Expected Results: The program should throw an OverflowException. How often does this happen? Always. Additional Information: The following program fails to compile with the error "error CS0220: The operation overflows at compile time in checked mode": public class Bug { public static void Main() { System.Console.WriteLine(long.MaxValue * 2); } } The following program throws an OverflowException at runtime: public class Bug { public static void Main() { long x = long.MaxValue; checked { System.Console.WriteLine(x * 2); } } } -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA contact for the bug. _______________________________________________ mono-bugs maillist - mono-bugs@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-bugs