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

Damien Diederen dd at crosstwine.com
Thu Jun 19 18:19:00 UTC 2014


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