[Mono-bugs] [Bug 494221] New: IL Compiles but generates wrong code

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sat Apr 11 18:46:56 EDT 2009


           Summary: IL Compiles but generates wrong code
    Classification: Mono
           Product: Mono: Compilers
           Version: 2.4.x
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Major
          Priority: P5 - None
         Component: IL assembler
        AssignedTo: jankit at novell.com
        ReportedBy: stephen at gennard.net
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---

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

Description of Problem:

The scope of .locals are not being observed, in the example provided two
locals groups are used, inside each one contains a declaration of an
item with the same name but rather than allocating two different slots
for the locals one is done.  Which means the second reference is uses 
a bad local slot.

Steps to reproduce the problem:
1. use the attached locals.il
2. ilasm locals.il
3. now use monodis to see the actual slot used eg:
   monodis locals.exe | grep stloc
   - you will see:
        IL_0001:  stloc 0
    IL_000f:  stloc 0

 But in the il, you can see we have used to different items:
      .locals init (class ['mscorlib']'System.Exception' _MF_LOCAL_1)
      .locals init (string _MF_LOCAL_1)

 These can not share the same slot because they are not the same time.

 My understanding is that each .locals item should have its own slot and the
 scope for their names should also be local to the containing group.

You can also see the issue, if you check to see if the code can verify.
 pedump --verify code locals.exe
 In method: LOCALS::LOCALS()
 Not Verifiable: Incompatible type [Complex], type [Complex] was expected in 
local store at 0x000f
 Not Verifiable: fallthru off try block at 0x0001

NOTE: Microsoft ilasm works as expected and when you ildasm you get different
slot numbers eg; stloc 0 and stloc 1 etc..

Actual Results:
 the two .locals share the same slot

Expected Results:
 the two .locals do not share the same slot

How often does this happen? 

Additional Information:
 The issue was found while attempting to get our compiler working
 with mono and due to the nature of the bug we feel it is important.

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