[Mono-dev] Linux x86: marshal7.cs failure

Damien Diederen dd at crosstwine.com
Sat Jun 21 14:17:03 UTC 2014


Hi Rodrigo,

> Linux and OSX have different alignment rules, that's why the difference.

I understand that.  My point is that in this particular case, GCC says
12 on 32-bit linux—as it does on OS X.  Mono computes 12, too.  But the
test checks for 16.

> This was fixed a few months back on master. If it's failing please file a
> bug report.

Done: https://bugzilla.xamarin.com/show_bug.cgi?id=20788

Thanks, -D


> On Thu, Jun 19, 2014 at 2:19 PM, Damien Diederen <dd at crosstwine.com> wrote:
>
>>
>> Hello,
>>
>> I am observing the following failure on Linux 86:
>>
>>     $ cd mono/tests
>>     $ mono marshal7.exe; echo $?
>>     14
>>
>> which corresponds to the following check:
>>
>>     if (Marshal.SizeOf (typeof (TestStruct8)) != 16)
>>         return 14;
>>
>> My current build of Mono returns 12.  Which seems reasonable according
>> to GCC (on the same machine, and on any 32-bit Linux I could test it
>> on):
>>
>>     $ cat > foo.c
>>     #include <stdio.h>
>>     #include <stddef.h>
>>     #include <stdint.h>
>>
>>     struct TestStruct8 {
>>             int a;
>>             uint64_t b;
>>     };
>>
>>     int main(int argc, char **argv) {
>>             size_t size = sizeof(struct TestStruct8);
>>             size_t offset_a = offsetof(struct TestStruct8, a);
>>             size_t offset_b = offsetof(struct TestStruct8, b);
>>
>>             printf("Size: %zu, Offset A: %zu, Offset B: %zu\n",
>>                    size, offset_a, offset_b);
>>             return 0;
>>     }
>>     ^D
>>     $ gcc -m32 -g -Wall -o foo foo.c
>>     $ ./foo
>>     Size: 12, Offset A: 0, Offset B: 4
>>
>> Could the test be wrong, and should 32-bit Linux be folded with OS X:
>>
>>     if (IsOSX () && IntPtr.Size == 4) {
>>             if (Marshal.SizeOf (typeof (TestStruct8)) != 12)
>>                     return 14;
>>             ...
>>
>> The test was last modified with the fix to Bug #4510, which is
>> relatively recent; could it be that it has not been verified on a 32-bit
>> Linux machine yet?
>>
>> Thanks,
>> Damien

-- 
http://crosstwine.com
tel:  +49 89 2189 2939
cell: +49 174 3489 428

“Strong Opinions, Weakly Held”
                 — Bob Johansen


More information about the Mono-devel-list mailing list