[Mono-bugs] [Bug 400014] New: Intrins Math.Max and Math.Min incorrect for uint

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Jun 13 08:08:26 EDT 2008


https://bugzilla.novell.com/show_bug.cgi?id=400014

User mono at grant.x43.net added comment
https://bugzilla.novell.com/show_bug.cgi?id=400014#c324675

           Summary: Intrins Math.Max and Math.Min incorrect for uint
           Product: Mono: Runtime
           Version: 1.9.0
          Platform: x86
        OS/Version: Windows XP
            Status: NEW
          Severity: Major
          Priority: P5 - None
         Component: JIT
        AssignedTo: lupus at novell.com
        ReportedBy: mono at grant.x43.net
         QAContact: mono-bugs at lists.ximian.com
          Found By: Third Party Developer/Partner


Created an attachment (id=222024)
 --> (https://bugzilla.novell.com/attachment.cgi?id=222024)
Test exposing incorrect uint Math.Min and Math.Max intrinsic

(I'm actually testing in the 1.9.1 release, which appears to not be in the list
of versions. This is very similar to bug #324675, but this is for uints and bug
#324675 isn't present in my version.)

Given the following code (also attached):
uint a = (uint)int.MaxValue + 10;
for (uint b = 7; b <= 10; ++b)
{
    Console.WriteLine("Max(" + a + "," + b + ") = " + Math.Max(a, b));
    Console.WriteLine("Max(" + b + "," + a + ") = " + Math.Max(b, a));
    Console.WriteLine("Min(" + a + "," + b + ") = " + Math.Min(a, b));
    Console.WriteLine("Min(" + b + "," + a + ") = " + Math.Min(b, a));
    Console.WriteLine();
}

Incorrect output from mono baduintminmax.exe:
Max(2147483657,7) = 7
Max(7,2147483657) = 7
Min(2147483657,7) = 2147483657
Min(7,2147483657) = 2147483657

Max(2147483657,8) = 8
Max(8,2147483657) = 8
Min(2147483657,8) = 2147483657
Min(8,2147483657) = 2147483657

Max(2147483657,9) = 9
Max(9,2147483657) = 2147483657
Min(2147483657,9) = 2147483657
Min(9,2147483657) = 9

Max(2147483657,10) = 2147483657
Max(10,2147483657) = 2147483657
Min(2147483657,10) = 10
Min(10,2147483657) = 10

Correct output from mono --optimize=-intrins baduintminmax.exe
Max(2147483657,7) = 2147483657
Max(7,2147483657) = 2147483657
Min(2147483657,7) = 7
Min(7,2147483657) = 7

Max(2147483657,8) = 2147483657
Max(8,2147483657) = 2147483657
Min(2147483657,8) = 8
Min(8,2147483657) = 8

Max(2147483657,9) = 2147483657
Max(9,2147483657) = 2147483657
Min(2147483657,9) = 9
Min(9,2147483657) = 9

Max(2147483657,10) = 2147483657
Max(10,2147483657) = 2147483657
Min(2147483657,10) = 10
Min(10,2147483657) = 10


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list