[Mono-bugs] [Bug 505375] New: JIT does not optimize do-while loop correctly

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue May 19 15:16:43 EDT 2009


http://bugzilla.novell.com/show_bug.cgi?id=505375


           Summary: JIT does not optimize do-while loop correctly
    Classification: Mono
           Product: Mono: Runtime
           Version: 2.4.x
          Platform: x86-64
        OS/Version: Ubuntu
            Status: NEW
          Severity: Major
          Priority: P5 - None
         Component: JIT
        AssignedTo: lupus at novell.com
        ReportedBy: jceberus at hotmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


Created an attachment (id=293132)
 --> (http://bugzilla.novell.com/attachment.cgi?id=293132)
Source code

User-Agent:       Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR
1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648;
NET CLR 3.5.21022; InfoPath.2)

JIT does not optimize do-while loop correctly. It produces
IndexOutOfRangeException but the index is really in range. Disable JIT
optimization will fix the problem.

Reproducible: Always

Steps to Reproduce:
1. Compile attached program with gmcs Program.cs.
2. Run the program with mono Program.exe. This produces
IndexOutOfRangeException.
3. Run the program with mono --debug=mdb-optimizations Program.exe. This
produces the expected result 234.
Actual Results:  
Unhandled Exception: System.IndexOutOfRangeException: Array index is out of
range.
  at ConsoleApplication1.Program.SelectNonPreserve[Double] (Int32 k,
System.Double[] data, IComparer`1 comparer) [0x00000]
  at ConsoleApplication1.Program.Main (System.String[] args) [0x00000]


Expected Results:  
234

Uncomment line 71, or changing the do-while loop to while loop will mitigate
the problem.

-- 
Configure bugmail: http://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