[Mono-bugs] [Bug 372412] New: gmcs don't emit readonly prefix for generic array access.

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Mar 19 12:14:06 EDT 2008


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

User rkumpera at novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=372412#c372410

           Summary: gmcs don't emit readonly prefix for generic array
                    access.
           Product: Mono: Compilers
           Version: unspecified
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: rkumpera at novell.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


When generics code need to do load the address of an array element of generic
type it must emit a readonly prefix, otherwise a
System.ArrayTypeMismatchException will be raised.


For example:

T[] t;
t[0].GetHashCode();

Must be compiled to:

ldc.i4.0 
readonly. 
ldelema !T
constrained. !T
callvirt instance int32 object::GetHashCode()


Right now gmcs don't emit the readonly. prefix. This applies to Array::Address
magic methods as well.

See #372410 for a test case and the long explanation of why the readonly prefix
is required.


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


More information about the mono-bugs mailing list