[Mono-bugs] [Bug 375160] New: Wrong struct packing.
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Fri Mar 28 21:28:31 EDT 2008
https://bugzilla.novell.com/show_bug.cgi?id=375160
Summary: Wrong struct packing.
Product: Mono: Runtime
Version: SVN
Platform: x86-64
OS/Version: Linux
Status: NEW
Severity: Normal
Priority: P5 - None
Component: interop
AssignedTo: mono-bugs at lists.ximian.com
ReportedBy: jan.oravec at 6com.sk
QAContact: mono-bugs at lists.ximian.com
Found By: ---
Let's have structures (on x86-64):
[ StructLayout (LayoutKind.Sequential, Pack = 8) ]
unsafe struct X
{
fixed int x[N]; // fixed-size buffer used only for convenience
}
[ StructLayout (LayoutKind.Sequential, Pack = 8) ]
struct Y
{
int a;
X x;
}
Mono makes this packing:
N sizeof (X) sizeof (Y)
1 4 8
2 8 16 (Wrong!)
3 12 16
4 16 20
5 20 24
..
Special case N = 2 produces wrong result, which makes interoperability problems
with legacy C code. sizeof (Y) = 12 is expected, as struct X doesn't contain
any fields with 8-byte alignment requirements (N = 4 produces correct result).
--
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