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

2014-06-19 Thread Damien Diederen

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
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


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

2014-06-19 Thread Rodrigo Kumpera
Linux and OSX have different alignment rules, that's why the difference.

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

--
Rodrigo


On Thu, Jun 19, 2014 at 2:19 PM, Damien Diederen d...@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
 ___
 Mono-devel-list mailing list
 Mono-devel-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-devel-list

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list