[Mono-bugs] [Bug 697898] New: size of structures with StructLayout(LayoutKind.Explicit) -- Attribute

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Jun 3 06:02:34 EDT 2011


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

https://bugzilla.novell.com/show_bug.cgi?id=697898#c0


           Summary: size of structures with
                    StructLayout(LayoutKind.Explicit) -- Attribute
    Classification: Mono
           Product: Mono: Runtime
           Version: 2.10.x
          Platform: x86-64
        OS/Version: Windows 7
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: JIT
        AssignedTo: lupus at novell.com
        ReportedBy: kummer at fdy.tu-darmstadt.de
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


Description of Problem:


Steps to reproduce the problem:
===============================
create structure:
    [StructLayout(LayoutKind.Explicit)]
    public struct CUstream {
        public unit p;
    }

evaluate its size by
    CUdeviceptr d_data = default(CUdeviceptr);
    Console.WriteLine("sizeof CUdeviceptr: " + Marshal.SizeOf(d_data));

Actual Results:
===============
* On Mono 2.10.1, the size of CUstream will be 8

Expected Results:
=================
* On Mono 2.6.7, the size of CUstream will be 4
* With Microsoft .NET, the size is also 4


How often does this happen? 
===========================
allways

Additional Information:
=======================
* the result is independent of the compiler, i.e. I'm getting the same result
for Microsoft and .NET compiler
* We used the Explicit layout with Pinvoke (for caling the Cuda Library); a fix
is to use the Sequential layout, wich produces the same result for all tested
runtimes; I think, because the Explicit layout only makes sense together with
PInvoke, it should behave equal on all runtimes?

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