[Mono-bugs] [Bug 82001][Maj] New - Bug in the Math.Max function

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Tue Jul 3 13:47:49 EDT 2007

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 dan.maser at inin.com.


--- shadow/82001	2007-07-03 13:47:49.000000000 -0400
+++ shadow/82001.tmp.20335	2007-07-03 13:47:49.000000000 -0400
@@ -0,0 +1,52 @@
+Bug#: 82001
+Product: Mono: Class Libraries
+Version: 1.2
+OS: All
+OS Details: RHEL WS 4, kernel 2.6.9-42 on i686 
+Status: NEW   
+Priority: Major
+Component: System
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: Dan.Maser at inin.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+Summary: Bug in the Math.Max function
+Please fill in this template when reporting a bug, unless you know what 
+you are doing.
+Description of Problem:
+The following code prints -2147483647 when it should print 100.  I'm 
+using SVN head as of 7/3/2007.  Robert Jordan verified this on his build 
+(/trunk/ r80002) and said it doesn't happen if you do "mono --optimize=-
+Here's the code:
+    int a = 100;
+    int b = -2147483647;
+    System.Console.WriteLine(String.Format("Math.Max(a, b) is {0}",
+                                                Math.Max(a, b)));
+Steps to reproduce the problem:
+1. Compile the above code with the default compiler options.  It says 
+that 100 is not bigger than -2147483647, but it is.  Rumor has it that 
+this doesn't happen with "mono --optimize=-all"
+Actual Results:
+The code prints "-2147483647"
+Expected Results:
+It should print "100"
+How often does this happen? 
+every time, unless the optimizations are adjusted
+Additional Information:

More information about the mono-bugs mailing list