[Mono-bugs] [Bug 580189] New: size IL instruction

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Feb 16 09:01:49 EST 2010


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

http://bugzilla.novell.com/show_bug.cgi?id=580189#c0


           Summary: size IL instruction
    Classification: Mono
           Product: Mono: Runtime
           Version: 2.6.x
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: JIT
        AssignedTo: lupus at novell.com
        ReportedBy: fgeo at hotmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


Created an attachment (id=342655)
 --> (http://bugzilla.novell.com/attachment.cgi?id=342655)
IL source code for repro

User-Agent:       Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64;
Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729;
Media Center PC 6.0; Zune 4.0)

The IL instruction

Reproducible: Always

Steps to Reproduce:
1. Assemble attached IL repro code with ilasm tool.
2. Execute resulting executable.
Actual Results:  
Output:

Mono 2.6.1 amd64 on Ubuntu x86/64 built from sources tarball (all default):

sizeof(int8): 4
sizeof(int32): 4
sizeof(int64): 8

sizeof(T) with T=int8: 8
sizeof(T) with T=int32: 8
sizeof(T) with T=int64: 8

&a[1] - &a[0] with int8[]: 1
&a[1] - &a[0] with int32[]: 4
&a[1] - &a[0] with int64[]: 8

---------------------

Mono 2.6.1 x86 on Windows 7 x64 (downloaded setup):

sizeof(int8): 4
sizeof(int32): 4
sizeof(int64): 8

sizeof(T) with T=int8: 4
sizeof(T) with T=int32: 4
sizeof(T) with T=int64: 4

&a[1] - &a[0] with int8[]: 1
&a[1] - &a[0] with int32[]: 4
&a[1] - &a[0] with int64[]: 8

Expected Results:  
All results should be 1 (int8), 4 (int32) and 8 (int64) for all ways of
computing native type size.

sizeof with generic type seems to always return the pointer size (native int)
even if not a reference type.

sizeof(int8) should return 1 as "&a[1] - &a[0] with int8[]:" is 1. As per CLI
specification, partition III, chapter 4.25:
"sizeof returns the total size that would be occupied by each element in an
array of this type – including any padding the implementation chooses to add.
Specifically, array elements lie sizeof bytes apart."

On the .NET Framework (Windows 7 x64), sizeof(int8) also returns 4 which is
wrong. But sizeof(T) and "&a[1] - &a[0]" return 1, 4, and 8.

-- 
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