File update_elf_abiv2_testcases.patch of Package mono-core

From 5013b989ed16303bc808a3d6570cddb4dfd8011d Mon Sep 17 00:00:00 2001
From: Bill Seurer <seurer@linux.vnet.ibm.com>
Date: Wed, 23 Sep 2015 15:44:24 -0500
Subject: [PATCH] [ppc] Updated ELF ABI v2 test cases to include returning
 structures from functions


---
 mono/tests/libtest.c       |  765 ++++++++++++++++++++------------------------
 mono/tests/pinvoke_ppcc.cs |  768 ++++++++++++++++++++++++++++++++++++++++-----
 mono/tests/pinvoke_ppcd.cs |  269 +++++++++++++--
 mono/tests/pinvoke_ppcf.cs |  243 +++++++++++---
 mono/tests/pinvoke_ppci.cs |  107 ++++--
 mono/tests/pinvoke_ppcs.cs |  263 +++++++++++++--
 6 files changed, 1783 insertions(+), 632 deletions(-)

Index: mono-4.2.1/mono/tests/libtest.c
===================================================================
--- mono-4.2.1.orig/mono/tests/libtest.c
+++ mono-4.2.1/mono/tests/libtest.c
@@ -5450,1670 +5450,1605 @@ typedef struct {
 	char f1;
 } sbyte1;
 
-LIBTEST_API char STDCALL
+LIBTEST_API sbyte1 STDCALL
 mono_return_sbyte1 (sbyte1 s1, int addend) {
 	if (s1.f1 != 1) {
 		fprintf(stderr, "mono_return_sbyte1 s1.f1: got %d but expected %d\n", s1.f1, 1);
-		return 1;
 	}
-		return 2*addend;
+	s1.f1+=addend;
+	return s1;
 }
 
 typedef struct {
 	char f1,f2;
 } sbyte2;
 
-LIBTEST_API char STDCALL
+LIBTEST_API sbyte2 STDCALL
 mono_return_sbyte2 (sbyte2 s2, int addend) {
 	if (s2.f1 != 1) {
 		fprintf(stderr, "mono_return_sbyte2 s2.f1: got %d but expected %d\n", s2.f1, 1);
-		return 1;
 	}
 	if (s2.f2 != 2) {
 		fprintf(stderr, "mono_return_sbyte2 s2.f2: got %d but expected %d\n", s2.f2, 2);
-		return 1;
 	}
-		return 2*addend;
+	s2.f1+=addend; s2.f2+=addend;
+	return s2;
 }
 
 typedef struct {
 	char f1,f2,f3;
 } sbyte3;
 
-LIBTEST_API char STDCALL
+LIBTEST_API sbyte3 STDCALL
 mono_return_sbyte3 (sbyte3 s3, int addend) {
 	if (s3.f1 != 1) {
 		fprintf(stderr, "mono_return_sbyte3 s3.f1: got %d but expected %d\n", s3.f1, 1);
-		return 1;
 	}
 	if (s3.f2 != 2) {
 		fprintf(stderr, "mono_return_sbyte3 s3.f2: got %d but expected %d\n", s3.f2, 2);
-		return 1;
 	}
 	if (s3.f3 != 3) {
 		fprintf(stderr, "mono_return_sbyte3 s3.f3: got %d but expected %d\n", s3.f3, 3);
-		return 1;
 	}
-		return 2*addend;
+	s3.f1+=addend; s3.f2+=addend; s3.f3+=addend;
+	return s3;
 }
 
 typedef struct {
 	char f1,f2,f3,f4;
 } sbyte4;
 
-LIBTEST_API char STDCALL
+LIBTEST_API sbyte4 STDCALL
 mono_return_sbyte4 (sbyte4 s4, int addend) {
 	if (s4.f1 != 1) {
 		fprintf(stderr, "mono_return_sbyte4 s4.f1: got %d but expected %d\n", s4.f1, 1);
-		return 1;
 	}
 	if (s4.f2 != 2) {
 		fprintf(stderr, "mono_return_sbyte4 s4.f2: got %d but expected %d\n", s4.f2, 2);
-		return 1;
 	}
 	if (s4.f3 != 3) {
 		fprintf(stderr, "mono_return_sbyte4 s4.f3: got %d but expected %d\n", s4.f3, 3);
-		return 1;
 	}
 	if (s4.f4 != 4) {
 		fprintf(stderr, "mono_return_sbyte4 s4.f4: got %d but expected %d\n", s4.f4, 4);
-		return 1;
 	}
-		return 2*addend;
+	s4.f1+=addend; s4.f2+=addend; s4.f3+=addend; s4.f4+=addend;
+	return s4;
 }
 
 typedef struct {
 	char f1,f2,f3,f4,f5;
 } sbyte5;
 
-LIBTEST_API char STDCALL
+LIBTEST_API sbyte5 STDCALL
 mono_return_sbyte5 (sbyte5 s5, int addend) {
 	if (s5.f1 != 1) {
 		fprintf(stderr, "mono_return_sbyte5 s5.f1: got %d but expected %d\n", s5.f1, 1);
-		return 1;
 	}
 	if (s5.f2 != 2) {
 		fprintf(stderr, "mono_return_sbyte5 s5.f2: got %d but expected %d\n", s5.f2, 2);
-		return 1;
 	}
 	if (s5.f3 != 3) {
 		fprintf(stderr, "mono_return_sbyte5 s5.f3: got %d but expected %d\n", s5.f3, 3);
-		return 1;
 	}
 	if (s5.f4 != 4) {
 		fprintf(stderr, "mono_return_sbyte5 s5.f4: got %d but expected %d\n", s5.f4, 4);
-		return 1;
 	}
 	if (s5.f5 != 5) {
 		fprintf(stderr, "mono_return_sbyte5 s5.f5: got %d but expected %d\n", s5.f5, 5);
-		return 1;
 	}
-		return 2*addend;
+	s5.f1+=addend; s5.f2+=addend; s5.f3+=addend; s5.f4+=addend; s5.f5+=addend;
+	return s5;
 }
 
 typedef struct {
 	char f1,f2,f3,f4,f5,f6;
 } sbyte6;
 
-LIBTEST_API char STDCALL
+LIBTEST_API sbyte6 STDCALL
 mono_return_sbyte6 (sbyte6 s6, int addend) {
 	if (s6.f1 != 1) {
 		fprintf(stderr, "mono_return_sbyte6 s6.f1: got %d but expected %d\n", s6.f1, 1);
-		return 1;
 	}
 	if (s6.f2 != 2) {
 		fprintf(stderr, "mono_return_sbyte6 s6.f2: got %d but expected %d\n", s6.f2, 2);
-		return 1;
 	}
 	if (s6.f3 != 3) {
 		fprintf(stderr, "mono_return_sbyte6 s6.f3: got %d but expected %d\n", s6.f3, 3);
-		return 1;
 	}
 	if (s6.f4 != 4) {
 		fprintf(stderr, "mono_return_sbyte6 s6.f4: got %d but expected %d\n", s6.f4, 4);
-		return 1;
 	}
 	if (s6.f5 != 5) {
 		fprintf(stderr, "mono_return_sbyte6 s6.f5: got %d but expected %d\n", s6.f5, 5);
-		return 1;
 	}
 	if (s6.f6 != 6) {
 		fprintf(stderr, "mono_return_sbyte6 s6.f6: got %d but expected %d\n", s6.f6, 6);
-		return 1;
 	}
-		return 2*addend;
+	s6.f1+=addend; s6.f2+=addend; s6.f3+=addend; s6.f4+=addend; s6.f5+=addend; s6.f6+=addend;
+	return s6;
 }
 
 typedef struct {
 	char f1,f2,f3,f4,f5,f6,f7;
 } sbyte7;
 
-LIBTEST_API char STDCALL
+LIBTEST_API sbyte7 STDCALL
 mono_return_sbyte7 (sbyte7 s7, int addend) {
 	if (s7.f1 != 1) {
 		fprintf(stderr, "mono_return_sbyte7 s7.f1: got %d but expected %d\n", s7.f1, 1);
-		return 1;
 	}
 	if (s7.f2 != 2) {
 		fprintf(stderr, "mono_return_sbyte7 s7.f2: got %d but expected %d\n", s7.f2, 2);
-		return 1;
 	}
 	if (s7.f3 != 3) {
 		fprintf(stderr, "mono_return_sbyte7 s7.f3: got %d but expected %d\n", s7.f3, 3);
-		return 1;
 	}
 	if (s7.f4 != 4) {
 		fprintf(stderr, "mono_return_sbyte7 s7.f4: got %d but expected %d\n", s7.f4, 4);
-		return 1;
 	}
 	if (s7.f5 != 5) {
 		fprintf(stderr, "mono_return_sbyte7 s7.f5: got %d but expected %d\n", s7.f5, 5);
-		return 1;
 	}
 	if (s7.f6 != 6) {
 		fprintf(stderr, "mono_return_sbyte7 s7.f6: got %d but expected %d\n", s7.f6, 6);
-		return 1;
 	}
 	if (s7.f7 != 7) {
 		fprintf(stderr, "mono_return_sbyte7 s7.f7: got %d but expected %d\n", s7.f7, 7);
-		return 1;
 	}
-		return 2*addend;
+	s7.f1+=addend; s7.f2+=addend; s7.f3+=addend; s7.f4+=addend; s7.f5+=addend; s7.f6+=addend; s7.f7+=addend;
+	return s7;
 }
 
 typedef struct {
 	char f1,f2,f3,f4,f5,f6,f7,f8;
 } sbyte8;
 
-LIBTEST_API char STDCALL
+LIBTEST_API sbyte8 STDCALL
 mono_return_sbyte8 (sbyte8 s8, int addend) {
 	if (s8.f1 != 1) {
 		fprintf(stderr, "mono_return_sbyte8 s8.f1: got %d but expected %d\n", s8.f1, 1);
-		return 1;
 	}
 	if (s8.f2 != 2) {
 		fprintf(stderr, "mono_return_sbyte8 s8.f2: got %d but expected %d\n", s8.f2, 2);
-		return 1;
 	}
 	if (s8.f3 != 3) {
 		fprintf(stderr, "mono_return_sbyte8 s8.f3: got %d but expected %d\n", s8.f3, 3);
-		return 1;
 	}
 	if (s8.f4 != 4) {
 		fprintf(stderr, "mono_return_sbyte8 s8.f4: got %d but expected %d\n", s8.f4, 4);
-		return 1;
 	}
 	if (s8.f5 != 5) {
 		fprintf(stderr, "mono_return_sbyte8 s8.f5: got %d but expected %d\n", s8.f5, 5);
-		return 1;
 	}
 	if (s8.f6 != 6) {
 		fprintf(stderr, "mono_return_sbyte8 s8.f6: got %d but expected %d\n", s8.f6, 6);
-		return 1;
 	}
 	if (s8.f7 != 7) {
 		fprintf(stderr, "mono_return_sbyte8 s8.f7: got %d but expected %d\n", s8.f7, 7);
-		return 1;
 	}
 	if (s8.f8 != 8) {
 		fprintf(stderr, "mono_return_sbyte8 s8.f8: got %d but expected %d\n", s8.f8, 8);
-		return 1;
 	}
-		return 2*addend;
+	s8.f1+=addend; s8.f2+=addend; s8.f3+=addend; s8.f4+=addend; s8.f5+=addend; s8.f6+=addend; s8.f7+=addend; s8.f8+=addend;
+	return s8;
 }
 
 typedef struct {
 	char f1,f2,f3,f4,f5,f6,f7,f8,f9;
 } sbyte9;
 
-LIBTEST_API char STDCALL
+LIBTEST_API sbyte9 STDCALL
 mono_return_sbyte9 (sbyte9 s9, int addend) {
 	if (s9.f1 != 1) {
 		fprintf(stderr, "mono_return_sbyte9 s9.f1: got %d but expected %d\n", s9.f1, 1);
-		return 1;
 	}
 	if (s9.f2 != 2) {
 		fprintf(stderr, "mono_return_sbyte9 s9.f2: got %d but expected %d\n", s9.f2, 2);
-		return 1;
 	}
 	if (s9.f3 != 3) {
 		fprintf(stderr, "mono_return_sbyte9 s9.f3: got %d but expected %d\n", s9.f3, 3);
-		return 1;
 	}
 	if (s9.f4 != 4) {
 		fprintf(stderr, "mono_return_sbyte9 s9.f4: got %d but expected %d\n", s9.f4, 4);
-		return 1;
 	}
 	if (s9.f5 != 5) {
 		fprintf(stderr, "mono_return_sbyte9 s9.f5: got %d but expected %d\n", s9.f5, 5);
-		return 1;
 	}
 	if (s9.f6 != 6) {
 		fprintf(stderr, "mono_return_sbyte9 s9.f6: got %d but expected %d\n", s9.f6, 6);
-		return 1;
 	}
 	if (s9.f7 != 7) {
 		fprintf(stderr, "mono_return_sbyte9 s9.f7: got %d but expected %d\n", s9.f7, 7);
-		return 1;
 	}
 	if (s9.f8 != 8) {
 		fprintf(stderr, "mono_return_sbyte9 s9.f8: got %d but expected %d\n", s9.f8, 8);
-		return 1;
 	}
 	if (s9.f9 != 9) {
 		fprintf(stderr, "mono_return_sbyte9 s9.f9: got %d but expected %d\n", s9.f9, 9);
-		return 1;
 	}
-		return 2*addend;
+	s9.f1+=addend; s9.f2+=addend; s9.f3+=addend; s9.f4+=addend; s9.f5+=addend; s9.f6+=addend; s9.f7+=addend; s9.f8+=addend; s9.f9+=addend;
+	return s9;
 }
 
 typedef struct {
 	char f1,f2,f3,f4,f5,f6,f7,f8,f9,f10;
 } sbyte10;
 
-LIBTEST_API char STDCALL
+LIBTEST_API sbyte10 STDCALL
 mono_return_sbyte10 (sbyte10 s10, int addend) {
 	if (s10.f1 != 1) {
 		fprintf(stderr, "mono_return_sbyte10 s10.f1: got %d but expected %d\n", s10.f1, 1);
-		return 1;
 	}
 	if (s10.f2 != 2) {
 		fprintf(stderr, "mono_return_sbyte10 s10.f2: got %d but expected %d\n", s10.f2, 2);
-		return 1;
 	}
 	if (s10.f3 != 3) {
 		fprintf(stderr, "mono_return_sbyte10 s10.f3: got %d but expected %d\n", s10.f3, 3);
-		return 1;
 	}
 	if (s10.f4 != 4) {
 		fprintf(stderr, "mono_return_sbyte10 s10.f4: got %d but expected %d\n", s10.f4, 4);
-		return 1;
 	}
 	if (s10.f5 != 5) {
 		fprintf(stderr, "mono_return_sbyte10 s10.f5: got %d but expected %d\n", s10.f5, 5);
-		return 1;
 	}
 	if (s10.f6 != 6) {
 		fprintf(stderr, "mono_return_sbyte10 s10.f6: got %d but expected %d\n", s10.f6, 6);
-		return 1;
 	}
 	if (s10.f7 != 7) {
 		fprintf(stderr, "mono_return_sbyte10 s10.f7: got %d but expected %d\n", s10.f7, 7);
-		return 1;
 	}
 	if (s10.f8 != 8) {
 		fprintf(stderr, "mono_return_sbyte10 s10.f8: got %d but expected %d\n", s10.f8, 8);
-		return 1;
 	}
 	if (s10.f9 != 9) {
 		fprintf(stderr, "mono_return_sbyte10 s10.f9: got %d but expected %d\n", s10.f9, 9);
-		return 1;
 	}
 	if (s10.f10 != 10) {
 		fprintf(stderr, "mono_return_sbyte10 s10.f10: got %d but expected %d\n", s10.f10, 10);
-		return 1;
 	}
-		return 2*addend;
+	s10.f1+=addend; s10.f2+=addend; s10.f3+=addend; s10.f4+=addend; s10.f5+=addend; s10.f6+=addend; s10.f7+=addend; s10.f8+=addend; s10.f9+=addend; s10.f10+=addend;
+	return s10;
 }
 
 typedef struct {
 	char f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11;
 } sbyte11;
 
-LIBTEST_API char STDCALL
+LIBTEST_API sbyte11 STDCALL
 mono_return_sbyte11 (sbyte11 s11, int addend) {
 	if (s11.f1 != 1) {
 		fprintf(stderr, "mono_return_sbyte11 s11.f1: got %d but expected %d\n", s11.f1, 1);
-		return 1;
 	}
 	if (s11.f2 != 2) {
 		fprintf(stderr, "mono_return_sbyte11 s11.f2: got %d but expected %d\n", s11.f2, 2);
-		return 1;
 	}
 	if (s11.f3 != 3) {
 		fprintf(stderr, "mono_return_sbyte11 s11.f3: got %d but expected %d\n", s11.f3, 3);
-		return 1;
 	}
 	if (s11.f4 != 4) {
 		fprintf(stderr, "mono_return_sbyte11 s11.f4: got %d but expected %d\n", s11.f4, 4);
-		return 1;
 	}
 	if (s11.f5 != 5) {
 		fprintf(stderr, "mono_return_sbyte11 s11.f5: got %d but expected %d\n", s11.f5, 5);
-		return 1;
 	}
 	if (s11.f6 != 6) {
 		fprintf(stderr, "mono_return_sbyte11 s11.f6: got %d but expected %d\n", s11.f6, 6);
-		return 1;
 	}
 	if (s11.f7 != 7) {
 		fprintf(stderr, "mono_return_sbyte11 s11.f7: got %d but expected %d\n", s11.f7, 7);
-		return 1;
 	}
 	if (s11.f8 != 8) {
 		fprintf(stderr, "mono_return_sbyte11 s11.f8: got %d but expected %d\n", s11.f8, 8);
-		return 1;
 	}
 	if (s11.f9 != 9) {
 		fprintf(stderr, "mono_return_sbyte11 s11.f9: got %d but expected %d\n", s11.f9, 9);
-		return 1;
 	}
 	if (s11.f10 != 10) {
 		fprintf(stderr, "mono_return_sbyte11 s11.f10: got %d but expected %d\n", s11.f10, 10);
-		return 1;
 	}
 	if (s11.f11 != 11) {
 		fprintf(stderr, "mono_return_sbyte11 s11.f11: got %d but expected %d\n", s11.f11, 11);
-		return 1;
 	}
-		return 2*addend;
+	s11.f1+=addend; s11.f2+=addend; s11.f3+=addend; s11.f4+=addend; s11.f5+=addend; s11.f6+=addend; s11.f7+=addend; s11.f8+=addend; s11.f9+=addend; s11.f10+=addend; s11.f11+=addend;
+	return s11;
 }
 
 typedef struct {
 	char f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12;
 } sbyte12;
 
-LIBTEST_API char STDCALL
+LIBTEST_API sbyte12 STDCALL
 mono_return_sbyte12 (sbyte12 s12, int addend) {
 	if (s12.f1 != 1) {
 		fprintf(stderr, "mono_return_sbyte12 s12.f1: got %d but expected %d\n", s12.f1, 1);
-		return 1;
 	}
 	if (s12.f2 != 2) {
 		fprintf(stderr, "mono_return_sbyte12 s12.f2: got %d but expected %d\n", s12.f2, 2);
-		return 1;
 	}
 	if (s12.f3 != 3) {
 		fprintf(stderr, "mono_return_sbyte12 s12.f3: got %d but expected %d\n", s12.f3, 3);
-		return 1;
 	}
 	if (s12.f4 != 4) {
 		fprintf(stderr, "mono_return_sbyte12 s12.f4: got %d but expected %d\n", s12.f4, 4);
-		return 1;
 	}
 	if (s12.f5 != 5) {
 		fprintf(stderr, "mono_return_sbyte12 s12.f5: got %d but expected %d\n", s12.f5, 5);
-		return 1;
 	}
 	if (s12.f6 != 6) {
 		fprintf(stderr, "mono_return_sbyte12 s12.f6: got %d but expected %d\n", s12.f6, 6);
-		return 1;
 	}
 	if (s12.f7 != 7) {
 		fprintf(stderr, "mono_return_sbyte12 s12.f7: got %d but expected %d\n", s12.f7, 7);
-		return 1;
 	}
 	if (s12.f8 != 8) {
 		fprintf(stderr, "mono_return_sbyte12 s12.f8: got %d but expected %d\n", s12.f8, 8);
-		return 1;
 	}
 	if (s12.f9 != 9) {
 		fprintf(stderr, "mono_return_sbyte12 s12.f9: got %d but expected %d\n", s12.f9, 9);
-		return 1;
 	}
 	if (s12.f10 != 10) {
 		fprintf(stderr, "mono_return_sbyte12 s12.f10: got %d but expected %d\n", s12.f10, 10);
-		return 1;
 	}
 	if (s12.f11 != 11) {
 		fprintf(stderr, "mono_return_sbyte12 s12.f11: got %d but expected %d\n", s12.f11, 11);
-		return 1;
 	}
 	if (s12.f12 != 12) {
 		fprintf(stderr, "mono_return_sbyte12 s12.f12: got %d but expected %d\n", s12.f12, 12);
-		return 1;
 	}
-		return 2*addend;
+	s12.f1+=addend; s12.f2+=addend; s12.f3+=addend; s12.f4+=addend; s12.f5+=addend; s12.f6+=addend; s12.f7+=addend; s12.f8+=addend; s12.f9+=addend; s12.f10+=addend; s12.f11+=addend; s12.f12+=addend;
+	return s12;
 }
 
 typedef struct {
 	char f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13;
 } sbyte13;
 
-LIBTEST_API char STDCALL
+LIBTEST_API sbyte13 STDCALL
 mono_return_sbyte13 (sbyte13 s13, int addend) {
 	if (s13.f1 != 1) {
 		fprintf(stderr, "mono_return_sbyte13 s13.f1: got %d but expected %d\n", s13.f1, 1);
-		return 1;
 	}
 	if (s13.f2 != 2) {
 		fprintf(stderr, "mono_return_sbyte13 s13.f2: got %d but expected %d\n", s13.f2, 2);
-		return 1;
 	}
 	if (s13.f3 != 3) {
 		fprintf(stderr, "mono_return_sbyte13 s13.f3: got %d but expected %d\n", s13.f3, 3);
-		return 1;
 	}
 	if (s13.f4 != 4) {
 		fprintf(stderr, "mono_return_sbyte13 s13.f4: got %d but expected %d\n", s13.f4, 4);
-		return 1;
 	}
 	if (s13.f5 != 5) {
 		fprintf(stderr, "mono_return_sbyte13 s13.f5: got %d but expected %d\n", s13.f5, 5);
-		return 1;
 	}
 	if (s13.f6 != 6) {
 		fprintf(stderr, "mono_return_sbyte13 s13.f6: got %d but expected %d\n", s13.f6, 6);
-		return 1;
 	}
 	if (s13.f7 != 7) {
 		fprintf(stderr, "mono_return_sbyte13 s13.f7: got %d but expected %d\n", s13.f7, 7);
-		return 1;
 	}
 	if (s13.f8 != 8) {
 		fprintf(stderr, "mono_return_sbyte13 s13.f8: got %d but expected %d\n", s13.f8, 8);
-		return 1;
 	}
 	if (s13.f9 != 9) {
 		fprintf(stderr, "mono_return_sbyte13 s13.f9: got %d but expected %d\n", s13.f9, 9);
-		return 1;
 	}
 	if (s13.f10 != 10) {
 		fprintf(stderr, "mono_return_sbyte13 s13.f10: got %d but expected %d\n", s13.f10, 10);
-		return 1;
 	}
 	if (s13.f11 != 11) {
 		fprintf(stderr, "mono_return_sbyte13 s13.f11: got %d but expected %d\n", s13.f11, 11);
-		return 1;
 	}
 	if (s13.f12 != 12) {
 		fprintf(stderr, "mono_return_sbyte13 s13.f12: got %d but expected %d\n", s13.f12, 12);
-		return 1;
 	}
 	if (s13.f13 != 13) {
 		fprintf(stderr, "mono_return_sbyte13 s13.f13: got %d but expected %d\n", s13.f13, 13);
-		return 1;
 	}
-		return 2*addend;
+	s13.f1+=addend; s13.f2+=addend; s13.f3+=addend; s13.f4+=addend; s13.f5+=addend; s13.f6+=addend; s13.f7+=addend; s13.f8+=addend; s13.f9+=addend; s13.f10+=addend; s13.f11+=addend; s13.f12+=addend; s13.f13+=addend;
+	return s13;
 }
 
 typedef struct {
 	char f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14;
 } sbyte14;
 
-LIBTEST_API char STDCALL
+LIBTEST_API sbyte14 STDCALL
 mono_return_sbyte14 (sbyte14 s14, int addend) {
 	if (s14.f1 != 1) {
 		fprintf(stderr, "mono_return_sbyte14 s14.f1: got %d but expected %d\n", s14.f1, 1);
-		return 1;
 	}
 	if (s14.f2 != 2) {
 		fprintf(stderr, "mono_return_sbyte14 s14.f2: got %d but expected %d\n", s14.f2, 2);
-		return 1;
 	}
 	if (s14.f3 != 3) {
 		fprintf(stderr, "mono_return_sbyte14 s14.f3: got %d but expected %d\n", s14.f3, 3);
-		return 1;
 	}
 	if (s14.f4 != 4) {
 		fprintf(stderr, "mono_return_sbyte14 s14.f4: got %d but expected %d\n", s14.f4, 4);
-		return 1;
 	}
 	if (s14.f5 != 5) {
 		fprintf(stderr, "mono_return_sbyte14 s14.f5: got %d but expected %d\n", s14.f5, 5);
-		return 1;
 	}
 	if (s14.f6 != 6) {
 		fprintf(stderr, "mono_return_sbyte14 s14.f6: got %d but expected %d\n", s14.f6, 6);
-		return 1;
 	}
 	if (s14.f7 != 7) {
 		fprintf(stderr, "mono_return_sbyte14 s14.f7: got %d but expected %d\n", s14.f7, 7);
-		return 1;
 	}
 	if (s14.f8 != 8) {
 		fprintf(stderr, "mono_return_sbyte14 s14.f8: got %d but expected %d\n", s14.f8, 8);
-		return 1;
 	}
 	if (s14.f9 != 9) {
 		fprintf(stderr, "mono_return_sbyte14 s14.f9: got %d but expected %d\n", s14.f9, 9);
-		return 1;
 	}
 	if (s14.f10 != 10) {
 		fprintf(stderr, "mono_return_sbyte14 s14.f10: got %d but expected %d\n", s14.f10, 10);
-		return 1;
 	}
 	if (s14.f11 != 11) {
 		fprintf(stderr, "mono_return_sbyte14 s14.f11: got %d but expected %d\n", s14.f11, 11);
-		return 1;
 	}
 	if (s14.f12 != 12) {
 		fprintf(stderr, "mono_return_sbyte14 s14.f12: got %d but expected %d\n", s14.f12, 12);
-		return 1;
 	}
 	if (s14.f13 != 13) {
 		fprintf(stderr, "mono_return_sbyte14 s14.f13: got %d but expected %d\n", s14.f13, 13);
-		return 1;
 	}
 	if (s14.f14 != 14) {
 		fprintf(stderr, "mono_return_sbyte14 s14.f14: got %d but expected %d\n", s14.f14, 14);
-		return 1;
 	}
-		return 2*addend;
+	s14.f1+=addend; s14.f2+=addend; s14.f3+=addend; s14.f4+=addend; s14.f5+=addend; s14.f6+=addend; s14.f7+=addend; s14.f8+=addend; s14.f9+=addend; s14.f10+=addend; s14.f11+=addend; s14.f12+=addend; s14.f13+=addend; s14.f14+=addend;
+	return s14;
 }
 
 typedef struct {
 	char f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15;
 } sbyte15;
 
-LIBTEST_API char STDCALL
+LIBTEST_API sbyte15 STDCALL
 mono_return_sbyte15 (sbyte15 s15, int addend) {
 	if (s15.f1 != 1) {
 		fprintf(stderr, "mono_return_sbyte15 s15.f1: got %d but expected %d\n", s15.f1, 1);
-		return 1;
 	}
 	if (s15.f2 != 2) {
 		fprintf(stderr, "mono_return_sbyte15 s15.f2: got %d but expected %d\n", s15.f2, 2);
-		return 1;
 	}
 	if (s15.f3 != 3) {
 		fprintf(stderr, "mono_return_sbyte15 s15.f3: got %d but expected %d\n", s15.f3, 3);
-		return 1;
 	}
 	if (s15.f4 != 4) {
 		fprintf(stderr, "mono_return_sbyte15 s15.f4: got %d but expected %d\n", s15.f4, 4);
-		return 1;
 	}
 	if (s15.f5 != 5) {
 		fprintf(stderr, "mono_return_sbyte15 s15.f5: got %d but expected %d\n", s15.f5, 5);
-		return 1;
 	}
 	if (s15.f6 != 6) {
 		fprintf(stderr, "mono_return_sbyte15 s15.f6: got %d but expected %d\n", s15.f6, 6);
-		return 1;
 	}
 	if (s15.f7 != 7) {
 		fprintf(stderr, "mono_return_sbyte15 s15.f7: got %d but expected %d\n", s15.f7, 7);
-		return 1;
 	}
 	if (s15.f8 != 8) {
 		fprintf(stderr, "mono_return_sbyte15 s15.f8: got %d but expected %d\n", s15.f8, 8);
-		return 1;
 	}
 	if (s15.f9 != 9) {
 		fprintf(stderr, "mono_return_sbyte15 s15.f9: got %d but expected %d\n", s15.f9, 9);
-		return 1;
 	}
 	if (s15.f10 != 10) {
 		fprintf(stderr, "mono_return_sbyte15 s15.f10: got %d but expected %d\n", s15.f10, 10);
-		return 1;
 	}
 	if (s15.f11 != 11) {
 		fprintf(stderr, "mono_return_sbyte15 s15.f11: got %d but expected %d\n", s15.f11, 11);
-		return 1;
 	}
 	if (s15.f12 != 12) {
 		fprintf(stderr, "mono_return_sbyte15 s15.f12: got %d but expected %d\n", s15.f12, 12);
-		return 1;
 	}
 	if (s15.f13 != 13) {
 		fprintf(stderr, "mono_return_sbyte15 s15.f13: got %d but expected %d\n", s15.f13, 13);
-		return 1;
 	}
 	if (s15.f14 != 14) {
 		fprintf(stderr, "mono_return_sbyte15 s15.f14: got %d but expected %d\n", s15.f14, 14);
-		return 1;
 	}
 	if (s15.f15 != 15) {
 		fprintf(stderr, "mono_return_sbyte15 s15.f15: got %d but expected %d\n", s15.f15, 15);
-		return 1;
 	}
-		return 2*addend;
+	s15.f1+=addend; s15.f2+=addend; s15.f3+=addend; s15.f4+=addend; s15.f5+=addend; s15.f6+=addend; s15.f7+=addend; s15.f8+=addend; s15.f9+=addend; s15.f10+=addend; s15.f11+=addend; s15.f12+=addend; s15.f13+=addend; s15.f14+=addend; s15.f15+=addend;
+	return s15;
 }
 
 typedef struct {
 	char f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15,f16;
 } sbyte16;
 
-LIBTEST_API char STDCALL
+LIBTEST_API sbyte16 STDCALL
 mono_return_sbyte16 (sbyte16 s16, int addend) {
 	if (s16.f1 != 1) {
 		fprintf(stderr, "mono_return_sbyte16 s16.f1: got %d but expected %d\n", s16.f1, 1);
-		return 1;
 	}
 	if (s16.f2 != 2) {
 		fprintf(stderr, "mono_return_sbyte16 s16.f2: got %d but expected %d\n", s16.f2, 2);
-		return 1;
 	}
 	if (s16.f3 != 3) {
 		fprintf(stderr, "mono_return_sbyte16 s16.f3: got %d but expected %d\n", s16.f3, 3);
-		return 1;
 	}
 	if (s16.f4 != 4) {
 		fprintf(stderr, "mono_return_sbyte16 s16.f4: got %d but expected %d\n", s16.f4, 4);
-		return 1;
 	}
 	if (s16.f5 != 5) {
 		fprintf(stderr, "mono_return_sbyte16 s16.f5: got %d but expected %d\n", s16.f5, 5);
-		return 1;
 	}
 	if (s16.f6 != 6) {
 		fprintf(stderr, "mono_return_sbyte16 s16.f6: got %d but expected %d\n", s16.f6, 6);
-		return 1;
 	}
 	if (s16.f7 != 7) {
 		fprintf(stderr, "mono_return_sbyte16 s16.f7: got %d but expected %d\n", s16.f7, 7);
-		return 1;
 	}
 	if (s16.f8 != 8) {
 		fprintf(stderr, "mono_return_sbyte16 s16.f8: got %d but expected %d\n", s16.f8, 8);
-		return 1;
 	}
 	if (s16.f9 != 9) {
 		fprintf(stderr, "mono_return_sbyte16 s16.f9: got %d but expected %d\n", s16.f9, 9);
-		return 1;
 	}
 	if (s16.f10 != 10) {
 		fprintf(stderr, "mono_return_sbyte16 s16.f10: got %d but expected %d\n", s16.f10, 10);
-		return 1;
 	}
 	if (s16.f11 != 11) {
 		fprintf(stderr, "mono_return_sbyte16 s16.f11: got %d but expected %d\n", s16.f11, 11);
-		return 1;
 	}
 	if (s16.f12 != 12) {
 		fprintf(stderr, "mono_return_sbyte16 s16.f12: got %d but expected %d\n", s16.f12, 12);
-		return 1;
 	}
 	if (s16.f13 != 13) {
 		fprintf(stderr, "mono_return_sbyte16 s16.f13: got %d but expected %d\n", s16.f13, 13);
-		return 1;
 	}
 	if (s16.f14 != 14) {
 		fprintf(stderr, "mono_return_sbyte16 s16.f14: got %d but expected %d\n", s16.f14, 14);
-		return 1;
 	}
 	if (s16.f15 != 15) {
 		fprintf(stderr, "mono_return_sbyte16 s16.f15: got %d but expected %d\n", s16.f15, 15);
-		return 1;
 	}
 	if (s16.f16 != 16) {
 		fprintf(stderr, "mono_return_sbyte16 s16.f16: got %d but expected %d\n", s16.f16, 16);
-		return 1;
 	}
-		return 2*addend;
+	s16.f1+=addend; s16.f2+=addend; s16.f3+=addend; s16.f4+=addend; s16.f5+=addend; s16.f6+=addend; s16.f7+=addend; s16.f8+=addend; s16.f9+=addend; s16.f10+=addend; s16.f11+=addend; s16.f12+=addend; s16.f13+=addend; s16.f14+=addend; s16.f15+=addend; s16.f16+=addend;
+	return s16;
 }
 
 typedef struct {
 	char f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15,f16,f17;
 } sbyte17;
 
-LIBTEST_API char STDCALL
+LIBTEST_API sbyte17 STDCALL
 mono_return_sbyte17 (sbyte17 s17, int addend) {
 	if (s17.f1 != 1) {
 		fprintf(stderr, "mono_return_sbyte17 s17.f1: got %d but expected %d\n", s17.f1, 1);
-		return 1;
 	}
 	if (s17.f2 != 2) {
 		fprintf(stderr, "mono_return_sbyte17 s17.f2: got %d but expected %d\n", s17.f2, 2);
-		return 1;
 	}
 	if (s17.f3 != 3) {
 		fprintf(stderr, "mono_return_sbyte17 s17.f3: got %d but expected %d\n", s17.f3, 3);
-		return 1;
 	}
 	if (s17.f4 != 4) {
 		fprintf(stderr, "mono_return_sbyte17 s17.f4: got %d but expected %d\n", s17.f4, 4);
-		return 1;
 	}
 	if (s17.f5 != 5) {
 		fprintf(stderr, "mono_return_sbyte17 s17.f5: got %d but expected %d\n", s17.f5, 5);
-		return 1;
 	}
 	if (s17.f6 != 6) {
 		fprintf(stderr, "mono_return_sbyte17 s17.f6: got %d but expected %d\n", s17.f6, 6);
-		return 1;
 	}
 	if (s17.f7 != 7) {
 		fprintf(stderr, "mono_return_sbyte17 s17.f7: got %d but expected %d\n", s17.f7, 7);
-		return 1;
 	}
 	if (s17.f8 != 8) {
 		fprintf(stderr, "mono_return_sbyte17 s17.f8: got %d but expected %d\n", s17.f8, 8);
-		return 1;
 	}
 	if (s17.f9 != 9) {
 		fprintf(stderr, "mono_return_sbyte17 s17.f9: got %d but expected %d\n", s17.f9, 9);
-		return 1;
 	}
 	if (s17.f10 != 10) {
 		fprintf(stderr, "mono_return_sbyte17 s17.f10: got %d but expected %d\n", s17.f10, 10);
-		return 1;
 	}
 	if (s17.f11 != 11) {
 		fprintf(stderr, "mono_return_sbyte17 s17.f11: got %d but expected %d\n", s17.f11, 11);
-		return 1;
 	}
 	if (s17.f12 != 12) {
 		fprintf(stderr, "mono_return_sbyte17 s17.f12: got %d but expected %d\n", s17.f12, 12);
-		return 1;
 	}
 	if (s17.f13 != 13) {
 		fprintf(stderr, "mono_return_sbyte17 s17.f13: got %d but expected %d\n", s17.f13, 13);
-		return 1;
 	}
 	if (s17.f14 != 14) {
 		fprintf(stderr, "mono_return_sbyte17 s17.f14: got %d but expected %d\n", s17.f14, 14);
-		return 1;
 	}
 	if (s17.f15 != 15) {
 		fprintf(stderr, "mono_return_sbyte17 s17.f15: got %d but expected %d\n", s17.f15, 15);
-		return 1;
 	}
 	if (s17.f16 != 16) {
 		fprintf(stderr, "mono_return_sbyte17 s17.f16: got %d but expected %d\n", s17.f16, 16);
-		return 1;
 	}
 	if (s17.f17 != 17) {
 		fprintf(stderr, "mono_return_sbyte17 s17.f17: got %d but expected %d\n", s17.f17, 17);
-		return 1;
 	}
-		return 2*addend;
+	s17.f1+=addend; s17.f2+=addend; s17.f3+=addend; s17.f4+=addend; s17.f5+=addend; s17.f6+=addend; s17.f7+=addend; s17.f8+=addend; s17.f9+=addend; s17.f10+=addend; s17.f11+=addend; s17.f12+=addend; s17.f13+=addend; s17.f14+=addend; s17.f15+=addend; s17.f16+=addend; s17.f17+=addend;
+	return s17;
 }
 
 typedef struct {
+	struct {
+		char f1;
+	} nested1;
+	char f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15;
+	struct {
+		char f16;
+	} nested2;
+} sbyte16_nested;
+
+LIBTEST_API sbyte16_nested STDCALL
+mono_return_sbyte16_nested (sbyte16_nested sn16, int addend) {
+	if (sn16.nested1.f1 != 1) {
+		fprintf(stderr, "mono_return_sbyte16_nested sn16.nested1.f1: got %d but expected %d\n", sn16.nested1.f1, 1);
+	}
+	if (sn16.f2 != 2) {
+		fprintf(stderr, "mono_return_sbyte16_nested sn16.f2: got %d but expected %d\n", sn16.f2, 2);
+	}
+	if (sn16.f3 != 3) {
+		fprintf(stderr, "mono_return_sbyte16_nested sn16.f3: got %d but expected %d\n", sn16.f3, 3);
+	}
+	if (sn16.f4 != 4) {
+		fprintf(stderr, "mono_return_sbyte16_nested sn16.f4: got %d but expected %d\n", sn16.f4, 4);
+	}
+	if (sn16.f5 != 5) {
+		fprintf(stderr, "mono_return_sbyte16_nested sn16.f5: got %d but expected %d\n", sn16.f5, 5);
+	}
+	if (sn16.f6 != 6) {
+		fprintf(stderr, "mono_return_sbyte16_nested sn16.f6: got %d but expected %d\n", sn16.f6, 6);
+	}
+	if (sn16.f7 != 7) {
+		fprintf(stderr, "mono_return_sbyte16_nested sn16.f7: got %d but expected %d\n", sn16.f7, 7);
+	}
+	if (sn16.f8 != 8) {
+		fprintf(stderr, "mono_return_sbyte16_nested sn16.f8: got %d but expected %d\n", sn16.f8, 8);
+	}
+	if (sn16.f9 != 9) {
+		fprintf(stderr, "mono_return_sbyte16_nested sn16.f9: got %d but expected %d\n", sn16.f9, 9);
+	}
+	if (sn16.f10 != 10) {
+		fprintf(stderr, "mono_return_sbyte16_nested sn16.f10: got %d but expected %d\n", sn16.f10, 10);
+	}
+	if (sn16.f11 != 11) {
+		fprintf(stderr, "mono_return_sbyte16_nested sn16.f11: got %d but expected %d\n", sn16.f11, 11);
+	}
+	if (sn16.f12 != 12) {
+		fprintf(stderr, "mono_return_sbyte16_nested sn16.f12: got %d but expected %d\n", sn16.f12, 12);
+	}
+	if (sn16.f13 != 13) {
+		fprintf(stderr, "mono_return_sbyte16_nested sn16.f13: got %d but expected %d\n", sn16.f13, 13);
+	}
+	if (sn16.f14 != 14) {
+		fprintf(stderr, "mono_return_sbyte16_nested sn16.f14: got %d but expected %d\n", sn16.f14, 14);
+	}
+	if (sn16.f15 != 15) {
+		fprintf(stderr, "mono_return_sbyte16_nested sn16.f15: got %d but expected %d\n", sn16.f15, 15);
+	}
+	if (sn16.nested2.f16 != 16) {
+		fprintf(stderr, "mono_return_sbyte16_nested sn16.nested2.f16: got %d but expected %d\n", sn16.nested2.f16, 16);
+	}
+	sn16.nested1.f1+=addend; sn16.f2+=addend; sn16.f3+=addend; sn16.f4+=addend; sn16.f5+=addend; sn16.f6+=addend; sn16.f7+=addend; sn16.f8+=addend; sn16.f9+=addend; sn16.f10+=addend; sn16.f11+=addend; sn16.f12+=addend; sn16.f13+=addend; sn16.f14+=addend; sn16.f15+=addend; sn16.nested2.f16+=addend;
+	return sn16;
+}
+
+
+typedef struct {
 	short f1;
 } short1;
 
-LIBTEST_API short STDCALL
+LIBTEST_API short1 STDCALL
 mono_return_short1 (short1 s1, int addend) {
 	if (s1.f1 != 1) {
 		fprintf(stderr, "mono_return_short1 s1.f1: got %d but expected %d\n", s1.f1, 1);
-		return 1;
 	}
-		return 2*addend;
+	s1.f1+=addend;
+	return s1;
 }
 
 typedef struct {
 	short f1,f2;
 } short2;
 
-LIBTEST_API short STDCALL
+LIBTEST_API short2 STDCALL
 mono_return_short2 (short2 s2, int addend) {
 	if (s2.f1 != 1) {
 		fprintf(stderr, "mono_return_short2 s2.f1: got %d but expected %d\n", s2.f1, 1);
-		return 1;
 	}
 	if (s2.f2 != 2) {
 		fprintf(stderr, "mono_return_short2 s2.f2: got %d but expected %d\n", s2.f2, 2);
-		return 1;
 	}
-		return 2*addend;
+	s2.f1+=addend; s2.f2+=addend;
+	return s2;
 }
 
 typedef struct {
 	short f1,f2,f3;
 } short3;
 
-LIBTEST_API short STDCALL
+LIBTEST_API short3 STDCALL
 mono_return_short3 (short3 s3, int addend) {
 	if (s3.f1 != 1) {
 		fprintf(stderr, "mono_return_short3 s3.f1: got %d but expected %d\n", s3.f1, 1);
-		return 1;
 	}
 	if (s3.f2 != 2) {
 		fprintf(stderr, "mono_return_short3 s3.f2: got %d but expected %d\n", s3.f2, 2);
-		return 1;
 	}
 	if (s3.f3 != 3) {
 		fprintf(stderr, "mono_return_short3 s3.f3: got %d but expected %d\n", s3.f3, 3);
-		return 1;
 	}
-		return 2*addend;
+	s3.f1+=addend; s3.f2+=addend; s3.f3+=addend;
+	return s3;
 }
 
 typedef struct {
 	short f1,f2,f3,f4;
 } short4;
 
-LIBTEST_API short STDCALL
+LIBTEST_API short4 STDCALL
 mono_return_short4 (short4 s4, int addend) {
 	if (s4.f1 != 1) {
 		fprintf(stderr, "mono_return_short4 s4.f1: got %d but expected %d\n", s4.f1, 1);
-		return 1;
 	}
 	if (s4.f2 != 2) {
 		fprintf(stderr, "mono_return_short4 s4.f2: got %d but expected %d\n", s4.f2, 2);
-		return 1;
 	}
 	if (s4.f3 != 3) {
 		fprintf(stderr, "mono_return_short4 s4.f3: got %d but expected %d\n", s4.f3, 3);
-		return 1;
 	}
 	if (s4.f4 != 4) {
 		fprintf(stderr, "mono_return_short4 s4.f4: got %d but expected %d\n", s4.f4, 4);
-		return 1;
 	}
-		return 2*addend;
+	s4.f1+=addend; s4.f2+=addend; s4.f3+=addend; s4.f4+=addend;
+	return s4;
 }
 
 typedef struct {
 	short f1,f2,f3,f4,f5;
 } short5;
 
-LIBTEST_API short STDCALL
+LIBTEST_API short5 STDCALL
 mono_return_short5 (short5 s5, int addend) {
 	if (s5.f1 != 1) {
 		fprintf(stderr, "mono_return_short5 s5.f1: got %d but expected %d\n", s5.f1, 1);
-		return 1;
 	}
 	if (s5.f2 != 2) {
 		fprintf(stderr, "mono_return_short5 s5.f2: got %d but expected %d\n", s5.f2, 2);
-		return 1;
 	}
 	if (s5.f3 != 3) {
 		fprintf(stderr, "mono_return_short5 s5.f3: got %d but expected %d\n", s5.f3, 3);
-		return 1;
 	}
 	if (s5.f4 != 4) {
 		fprintf(stderr, "mono_return_short5 s5.f4: got %d but expected %d\n", s5.f4, 4);
-		return 1;
 	}
 	if (s5.f5 != 5) {
 		fprintf(stderr, "mono_return_short5 s5.f5: got %d but expected %d\n", s5.f5, 5);
-		return 1;
 	}
-		return 2*addend;
+	s5.f1+=addend; s5.f2+=addend; s5.f3+=addend; s5.f4+=addend; s5.f5+=addend;
+	return s5;
 }
 
 typedef struct {
 	short f1,f2,f3,f4,f5,f6;
 } short6;
 
-LIBTEST_API short STDCALL
+LIBTEST_API short6 STDCALL
 mono_return_short6 (short6 s6, int addend) {
 	if (s6.f1 != 1) {
 		fprintf(stderr, "mono_return_short6 s6.f1: got %d but expected %d\n", s6.f1, 1);
-		return 1;
 	}
 	if (s6.f2 != 2) {
 		fprintf(stderr, "mono_return_short6 s6.f2: got %d but expected %d\n", s6.f2, 2);
-		return 1;
 	}
 	if (s6.f3 != 3) {
 		fprintf(stderr, "mono_return_short6 s6.f3: got %d but expected %d\n", s6.f3, 3);
-		return 1;
 	}
 	if (s6.f4 != 4) {
 		fprintf(stderr, "mono_return_short6 s6.f4: got %d but expected %d\n", s6.f4, 4);
-		return 1;
 	}
 	if (s6.f5 != 5) {
 		fprintf(stderr, "mono_return_short6 s6.f5: got %d but expected %d\n", s6.f5, 5);
-		return 1;
 	}
 	if (s6.f6 != 6) {
 		fprintf(stderr, "mono_return_short6 s6.f6: got %d but expected %d\n", s6.f6, 6);
-		return 1;
 	}
-		return 2*addend;
+	s6.f1+=addend; s6.f2+=addend; s6.f3+=addend; s6.f4+=addend; s6.f5+=addend; s6.f6+=addend;
+	return s6;
 }
 
 typedef struct {
 	short f1,f2,f3,f4,f5,f6,f7;
 } short7;
 
-LIBTEST_API short STDCALL
+LIBTEST_API short7 STDCALL
 mono_return_short7 (short7 s7, int addend) {
 	if (s7.f1 != 1) {
 		fprintf(stderr, "mono_return_short7 s7.f1: got %d but expected %d\n", s7.f1, 1);
-		return 1;
 	}
 	if (s7.f2 != 2) {
 		fprintf(stderr, "mono_return_short7 s7.f2: got %d but expected %d\n", s7.f2, 2);
-		return 1;
 	}
 	if (s7.f3 != 3) {
 		fprintf(stderr, "mono_return_short7 s7.f3: got %d but expected %d\n", s7.f3, 3);
-		return 1;
 	}
 	if (s7.f4 != 4) {
 		fprintf(stderr, "mono_return_short7 s7.f4: got %d but expected %d\n", s7.f4, 4);
-		return 1;
 	}
 	if (s7.f5 != 5) {
 		fprintf(stderr, "mono_return_short7 s7.f5: got %d but expected %d\n", s7.f5, 5);
-		return 1;
 	}
 	if (s7.f6 != 6) {
 		fprintf(stderr, "mono_return_short7 s7.f6: got %d but expected %d\n", s7.f6, 6);
-		return 1;
 	}
 	if (s7.f7 != 7) {
 		fprintf(stderr, "mono_return_short7 s7.f7: got %d but expected %d\n", s7.f7, 7);
-		return 1;
 	}
-		return 2*addend;
+	s7.f1+=addend; s7.f2+=addend; s7.f3+=addend; s7.f4+=addend; s7.f5+=addend; s7.f6+=addend; s7.f7+=addend;
+	return s7;
 }
 
 typedef struct {
 	short f1,f2,f3,f4,f5,f6,f7,f8;
 } short8;
 
-LIBTEST_API short STDCALL
+LIBTEST_API short8 STDCALL
 mono_return_short8 (short8 s8, int addend) {
 	if (s8.f1 != 1) {
 		fprintf(stderr, "mono_return_short8 s8.f1: got %d but expected %d\n", s8.f1, 1);
-		return 1;
 	}
 	if (s8.f2 != 2) {
 		fprintf(stderr, "mono_return_short8 s8.f2: got %d but expected %d\n", s8.f2, 2);
-		return 1;
 	}
 	if (s8.f3 != 3) {
 		fprintf(stderr, "mono_return_short8 s8.f3: got %d but expected %d\n", s8.f3, 3);
-		return 1;
 	}
 	if (s8.f4 != 4) {
 		fprintf(stderr, "mono_return_short8 s8.f4: got %d but expected %d\n", s8.f4, 4);
-		return 1;
 	}
 	if (s8.f5 != 5) {
 		fprintf(stderr, "mono_return_short8 s8.f5: got %d but expected %d\n", s8.f5, 5);
-		return 1;
 	}
 	if (s8.f6 != 6) {
 		fprintf(stderr, "mono_return_short8 s8.f6: got %d but expected %d\n", s8.f6, 6);
-		return 1;
 	}
 	if (s8.f7 != 7) {
 		fprintf(stderr, "mono_return_short8 s8.f7: got %d but expected %d\n", s8.f7, 7);
-		return 1;
 	}
 	if (s8.f8 != 8) {
 		fprintf(stderr, "mono_return_short8 s8.f8: got %d but expected %d\n", s8.f8, 8);
-		return 1;
 	}
-		return 2*addend;
+	s8.f1+=addend; s8.f2+=addend; s8.f3+=addend; s8.f4+=addend; s8.f5+=addend; s8.f6+=addend; s8.f7+=addend; s8.f8+=addend;
+	return s8;
 }
 
 typedef struct {
 	short f1,f2,f3,f4,f5,f6,f7,f8,f9;
 } short9;
 
-LIBTEST_API short STDCALL
+LIBTEST_API short9 STDCALL
 mono_return_short9 (short9 s9, int addend) {
 	if (s9.f1 != 1) {
 		fprintf(stderr, "mono_return_short9 s9.f1: got %d but expected %d\n", s9.f1, 1);
-		return 1;
 	}
 	if (s9.f2 != 2) {
 		fprintf(stderr, "mono_return_short9 s9.f2: got %d but expected %d\n", s9.f2, 2);
-		return 1;
 	}
 	if (s9.f3 != 3) {
 		fprintf(stderr, "mono_return_short9 s9.f3: got %d but expected %d\n", s9.f3, 3);
-		return 1;
 	}
 	if (s9.f4 != 4) {
 		fprintf(stderr, "mono_return_short9 s9.f4: got %d but expected %d\n", s9.f4, 4);
-		return 1;
 	}
 	if (s9.f5 != 5) {
 		fprintf(stderr, "mono_return_short9 s9.f5: got %d but expected %d\n", s9.f5, 5);
-		return 1;
 	}
 	if (s9.f6 != 6) {
 		fprintf(stderr, "mono_return_short9 s9.f6: got %d but expected %d\n", s9.f6, 6);
-		return 1;
 	}
 	if (s9.f7 != 7) {
 		fprintf(stderr, "mono_return_short9 s9.f7: got %d but expected %d\n", s9.f7, 7);
-		return 1;
 	}
 	if (s9.f8 != 8) {
 		fprintf(stderr, "mono_return_short9 s9.f8: got %d but expected %d\n", s9.f8, 8);
-		return 1;
 	}
 	if (s9.f9 != 9) {
 		fprintf(stderr, "mono_return_short9 s9.f9: got %d but expected %d\n", s9.f9, 9);
-		return 1;
 	}
-		return 2*addend;
+	s9.f1+=addend; s9.f2+=addend; s9.f3+=addend; s9.f4+=addend; s9.f5+=addend; s9.f6+=addend; s9.f7+=addend; s9.f8+=addend; s9.f9+=addend;
+	return s9;
+}
+
+typedef struct {
+	struct {
+		short f1;
+	} nested1;
+	short f2,f3,f4,f5,f6,f7;
+	struct {
+		short f8;
+	} nested2;
+} short8_nested;
+
+LIBTEST_API short8_nested STDCALL
+mono_return_short8_nested (short8_nested sn8, int addend) {
+	if (sn8.nested1.f1 != 1) {
+		fprintf(stderr, "mono_return_short8_nested sn8.nested1.f1: got %d but expected %d\n", sn8.nested1.f1, 1);
+	}
+	if (sn8.f2 != 2) {
+		fprintf(stderr, "mono_return_short8_nested sn8.f2: got %d but expected %d\n", sn8.f2, 2);
+	}
+	if (sn8.f3 != 3) {
+		fprintf(stderr, "mono_return_short8_nested sn8.f3: got %d but expected %d\n", sn8.f3, 3);
+	}
+	if (sn8.f4 != 4) {
+		fprintf(stderr, "mono_return_short8_nested sn8.f4: got %d but expected %d\n", sn8.f4, 4);
+	}
+	if (sn8.f5 != 5) {
+		fprintf(stderr, "mono_return_short8_nested sn8.f5: got %d but expected %d\n", sn8.f5, 5);
+	}
+	if (sn8.f6 != 6) {
+		fprintf(stderr, "mono_return_short8_nested sn8.f6: got %d but expected %d\n", sn8.f6, 6);
+	}
+	if (sn8.f7 != 7) {
+		fprintf(stderr, "mono_return_short8_nested sn8.f7: got %d but expected %d\n", sn8.f7, 7);
+	}
+	if (sn8.nested2.f8 != 8) {
+		fprintf(stderr, "mono_return_short8_nested sn8.nested2.f8: got %d but expected %d\n", sn8.nested2.f8, 8);
+	}
+	sn8.nested1.f1+=addend; sn8.f2+=addend; sn8.f3+=addend; sn8.f4+=addend; sn8.f5+=addend; sn8.f6+=addend; sn8.f7+=addend; sn8.nested2.f8+=addend;
+	return sn8;
 }
 
+
 typedef struct {
 	int f1;
 } int1;
 
-LIBTEST_API int STDCALL
+LIBTEST_API int1 STDCALL
 mono_return_int1 (int1 s1, int addend) {
 	if (s1.f1 != 1) {
 		fprintf(stderr, "mono_return_int1 s1.f1: got %d but expected %d\n", s1.f1, 1);
-		return 1;
 	}
-		return 2*addend;
+	s1.f1+=addend;
+	return s1;
 }
 
 typedef struct {
 	int f1,f2;
 } int2;
 
-LIBTEST_API int STDCALL
+LIBTEST_API int2 STDCALL
 mono_return_int2 (int2 s2, int addend) {
 	if (s2.f1 != 1) {
 		fprintf(stderr, "mono_return_int2 s2.f1: got %d but expected %d\n", s2.f1, 1);
-		return 1;
 	}
 	if (s2.f2 != 2) {
 		fprintf(stderr, "mono_return_int2 s2.f2: got %d but expected %d\n", s2.f2, 2);
-		return 1;
 	}
-		return 2*addend;
+	s2.f1+=addend; s2.f2+=addend;
+	return s2;
 }
 
 typedef struct {
 	int f1,f2,f3;
 } int3;
 
-LIBTEST_API int STDCALL
+LIBTEST_API int3 STDCALL
 mono_return_int3 (int3 s3, int addend) {
 	if (s3.f1 != 1) {
 		fprintf(stderr, "mono_return_int3 s3.f1: got %d but expected %d\n", s3.f1, 1);
-		return 1;
 	}
 	if (s3.f2 != 2) {
 		fprintf(stderr, "mono_return_int3 s3.f2: got %d but expected %d\n", s3.f2, 2);
-		return 1;
 	}
 	if (s3.f3 != 3) {
 		fprintf(stderr, "mono_return_int3 s3.f3: got %d but expected %d\n", s3.f3, 3);
-		return 1;
 	}
-		return 2*addend;
+	s3.f1+=addend; s3.f2+=addend; s3.f3+=addend;
+	return s3;
 }
 
 typedef struct {
 	int f1,f2,f3,f4;
 } int4;
 
-LIBTEST_API int STDCALL
+LIBTEST_API int4 STDCALL
 mono_return_int4 (int4 s4, int addend) {
 	if (s4.f1 != 1) {
 		fprintf(stderr, "mono_return_int4 s4.f1: got %d but expected %d\n", s4.f1, 1);
-		return 1;
 	}
 	if (s4.f2 != 2) {
 		fprintf(stderr, "mono_return_int4 s4.f2: got %d but expected %d\n", s4.f2, 2);
-		return 1;
 	}
 	if (s4.f3 != 3) {
 		fprintf(stderr, "mono_return_int4 s4.f3: got %d but expected %d\n", s4.f3, 3);
-		return 1;
 	}
 	if (s4.f4 != 4) {
 		fprintf(stderr, "mono_return_int4 s4.f4: got %d but expected %d\n", s4.f4, 4);
-		return 1;
 	}
-		return 2*addend;
+	s4.f1+=addend; s4.f2+=addend; s4.f3+=addend; s4.f4+=addend;
+	return s4;
 }
 
 typedef struct {
 	int f1,f2,f3,f4,f5;
 } int5;
 
-LIBTEST_API int STDCALL
+LIBTEST_API int5 STDCALL
 mono_return_int5 (int5 s5, int addend) {
 	if (s5.f1 != 1) {
 		fprintf(stderr, "mono_return_int5 s5.f1: got %d but expected %d\n", s5.f1, 1);
-		return 1;
 	}
 	if (s5.f2 != 2) {
 		fprintf(stderr, "mono_return_int5 s5.f2: got %d but expected %d\n", s5.f2, 2);
-		return 1;
 	}
 	if (s5.f3 != 3) {
 		fprintf(stderr, "mono_return_int5 s5.f3: got %d but expected %d\n", s5.f3, 3);
-		return 1;
 	}
 	if (s5.f4 != 4) {
 		fprintf(stderr, "mono_return_int5 s5.f4: got %d but expected %d\n", s5.f4, 4);
-		return 1;
 	}
 	if (s5.f5 != 5) {
 		fprintf(stderr, "mono_return_int5 s5.f5: got %d but expected %d\n", s5.f5, 5);
-		return 1;
 	}
-		return 2*addend;
+	s5.f1+=addend; s5.f2+=addend; s5.f3+=addend; s5.f4+=addend; s5.f5+=addend;
+	return s5;
+}
+
+typedef struct {
+	struct {
+		int f1;
+	} nested1;
+	int f2,f3;
+	struct {
+		int f4;
+	} nested2;
+} int4_nested;
+
+LIBTEST_API int4_nested STDCALL
+mono_return_int4_nested (int4_nested sn4, int addend) {
+	if (sn4.nested1.f1 != 1) {
+		fprintf(stderr, "mono_return_int4_nested sn4.nested1.f1: got %d but expected %d\n", sn4.nested1.f1, 1);
+	}
+	if (sn4.f2 != 2) {
+		fprintf(stderr, "mono_return_int4_nested sn4.f2: got %d but expected %d\n", sn4.f2, 2);
+	}
+	if (sn4.f3 != 3) {
+		fprintf(stderr, "mono_return_int4_nested sn4.f3: got %d but expected %d\n", sn4.f3, 3);
+	}
+	if (sn4.nested2.f4 != 4) {
+		fprintf(stderr, "mono_return_int4_nested sn4.nested2.f4: got %d but expected %d\n", sn4.nested2.f4, 4);
+	}
+	sn4.nested1.f1+=addend; sn4.f2+=addend; sn4.f3+=addend; sn4.nested2.f4+=addend;
+	return sn4;
 }
 
 typedef struct {
 	float f1;
 } float1;
 
-LIBTEST_API float STDCALL
+LIBTEST_API float1 STDCALL
 mono_return_float1 (float1 s1, int addend) {
 	if (s1.f1 != 1) {
 		fprintf(stderr, "mono_return_float1 s1.f1: got %f but expected %d\n", s1.f1, 1);
-		return 1;
 	}
-		return 2*addend;
+	s1.f1+=addend;
+	return s1;
 }
 
 typedef struct {
 	float f1,f2;
 } float2;
 
-LIBTEST_API float STDCALL
+LIBTEST_API float2 STDCALL
 mono_return_float2 (float2 s2, int addend) {
 	if (s2.f1 != 1) {
 		fprintf(stderr, "mono_return_float2 s2.f1: got %f but expected %d\n", s2.f1, 1);
-		return 1;
 	}
 	if (s2.f2 != 2) {
 		fprintf(stderr, "mono_return_float2 s2.f2: got %f but expected %d\n", s2.f2, 2);
-		return 1;
 	}
-		return 2*addend;
+	s2.f1+=addend; s2.f2+=addend;
+	return s2;
 }
 
 typedef struct {
 	float f1,f2,f3;
 } float3;
 
-LIBTEST_API float STDCALL
+LIBTEST_API float3 STDCALL
 mono_return_float3 (float3 s3, int addend) {
 	if (s3.f1 != 1) {
 		fprintf(stderr, "mono_return_float3 s3.f1: got %f but expected %d\n", s3.f1, 1);
-		return 1;
 	}
 	if (s3.f2 != 2) {
 		fprintf(stderr, "mono_return_float3 s3.f2: got %f but expected %d\n", s3.f2, 2);
-		return 1;
 	}
 	if (s3.f3 != 3) {
 		fprintf(stderr, "mono_return_float3 s3.f3: got %f but expected %d\n", s3.f3, 3);
-		return 1;
 	}
-		return 2*addend;
+	s3.f1+=addend; s3.f2+=addend; s3.f3+=addend;
+	return s3;
 }
 
 typedef struct {
 	float f1,f2,f3,f4;
 } float4;
 
-LIBTEST_API float STDCALL
+LIBTEST_API float4 STDCALL
 mono_return_float4 (float4 s4, int addend) {
 	if (s4.f1 != 1) {
 		fprintf(stderr, "mono_return_float4 s4.f1: got %f but expected %d\n", s4.f1, 1);
-		return 1;
 	}
 	if (s4.f2 != 2) {
 		fprintf(stderr, "mono_return_float4 s4.f2: got %f but expected %d\n", s4.f2, 2);
-		return 1;
 	}
 	if (s4.f3 != 3) {
 		fprintf(stderr, "mono_return_float4 s4.f3: got %f but expected %d\n", s4.f3, 3);
-		return 1;
 	}
 	if (s4.f4 != 4) {
 		fprintf(stderr, "mono_return_float4 s4.f4: got %f but expected %d\n", s4.f4, 4);
-		return 1;
 	}
-		return 2*addend;
+	s4.f1+=addend; s4.f2+=addend; s4.f3+=addend; s4.f4+=addend;
+	return s4;
 }
 
 typedef struct {
 	float f1,f2,f3,f4,f5;
 } float5;
 
-LIBTEST_API float STDCALL
+LIBTEST_API float5 STDCALL
 mono_return_float5 (float5 s5, int addend) {
 	if (s5.f1 != 1) {
 		fprintf(stderr, "mono_return_float5 s5.f1: got %f but expected %d\n", s5.f1, 1);
-		return 1;
 	}
 	if (s5.f2 != 2) {
 		fprintf(stderr, "mono_return_float5 s5.f2: got %f but expected %d\n", s5.f2, 2);
-		return 1;
 	}
 	if (s5.f3 != 3) {
 		fprintf(stderr, "mono_return_float5 s5.f3: got %f but expected %d\n", s5.f3, 3);
-		return 1;
 	}
 	if (s5.f4 != 4) {
 		fprintf(stderr, "mono_return_float5 s5.f4: got %f but expected %d\n", s5.f4, 4);
-		return 1;
 	}
 	if (s5.f5 != 5) {
 		fprintf(stderr, "mono_return_float5 s5.f5: got %f but expected %d\n", s5.f5, 5);
-		return 1;
 	}
-		return 2*addend;
+	s5.f1+=addend; s5.f2+=addend; s5.f3+=addend; s5.f4+=addend; s5.f5+=addend;
+	return s5;
 }
 
 typedef struct {
 	float f1,f2,f3,f4,f5,f6;
 } float6;
 
-LIBTEST_API float STDCALL
+LIBTEST_API float6 STDCALL
 mono_return_float6 (float6 s6, int addend) {
 	if (s6.f1 != 1) {
 		fprintf(stderr, "mono_return_float6 s6.f1: got %f but expected %d\n", s6.f1, 1);
-		return 1;
 	}
 	if (s6.f2 != 2) {
 		fprintf(stderr, "mono_return_float6 s6.f2: got %f but expected %d\n", s6.f2, 2);
-		return 1;
 	}
 	if (s6.f3 != 3) {
 		fprintf(stderr, "mono_return_float6 s6.f3: got %f but expected %d\n", s6.f3, 3);
-		return 1;
 	}
 	if (s6.f4 != 4) {
 		fprintf(stderr, "mono_return_float6 s6.f4: got %f but expected %d\n", s6.f4, 4);
-		return 1;
 	}
 	if (s6.f5 != 5) {
 		fprintf(stderr, "mono_return_float6 s6.f5: got %f but expected %d\n", s6.f5, 5);
-		return 1;
 	}
 	if (s6.f6 != 6) {
 		fprintf(stderr, "mono_return_float6 s6.f6: got %f but expected %d\n", s6.f6, 6);
-		return 1;
 	}
-		return 2*addend;
+	s6.f1+=addend; s6.f2+=addend; s6.f3+=addend; s6.f4+=addend; s6.f5+=addend; s6.f6+=addend;
+	return s6;
 }
 
 typedef struct {
 	float f1,f2,f3,f4,f5,f6,f7;
 } float7;
 
-LIBTEST_API float STDCALL
+LIBTEST_API float7 STDCALL
 mono_return_float7 (float7 s7, int addend) {
 	if (s7.f1 != 1) {
 		fprintf(stderr, "mono_return_float7 s7.f1: got %f but expected %d\n", s7.f1, 1);
-		return 1;
 	}
 	if (s7.f2 != 2) {
 		fprintf(stderr, "mono_return_float7 s7.f2: got %f but expected %d\n", s7.f2, 2);
-		return 1;
 	}
 	if (s7.f3 != 3) {
 		fprintf(stderr, "mono_return_float7 s7.f3: got %f but expected %d\n", s7.f3, 3);
-		return 1;
 	}
 	if (s7.f4 != 4) {
 		fprintf(stderr, "mono_return_float7 s7.f4: got %f but expected %d\n", s7.f4, 4);
-		return 1;
 	}
 	if (s7.f5 != 5) {
 		fprintf(stderr, "mono_return_float7 s7.f5: got %f but expected %d\n", s7.f5, 5);
-		return 1;
 	}
 	if (s7.f6 != 6) {
 		fprintf(stderr, "mono_return_float7 s7.f6: got %f but expected %d\n", s7.f6, 6);
-		return 1;
 	}
 	if (s7.f7 != 7) {
 		fprintf(stderr, "mono_return_float7 s7.f7: got %f but expected %d\n", s7.f7, 7);
-		return 1;
 	}
-		return 2*addend;
+	s7.f1+=addend; s7.f2+=addend; s7.f3+=addend; s7.f4+=addend; s7.f5+=addend; s7.f6+=addend; s7.f7+=addend;
+	return s7;
 }
 
 typedef struct {
 	float f1,f2,f3,f4,f5,f6,f7,f8;
 } float8;
 
-LIBTEST_API float STDCALL
+LIBTEST_API float8 STDCALL
 mono_return_float8 (float8 s8, int addend) {
 	if (s8.f1 != 1) {
 		fprintf(stderr, "mono_return_float8 s8.f1: got %f but expected %d\n", s8.f1, 1);
-		return 1;
 	}
 	if (s8.f2 != 2) {
 		fprintf(stderr, "mono_return_float8 s8.f2: got %f but expected %d\n", s8.f2, 2);
-		return 1;
 	}
 	if (s8.f3 != 3) {
 		fprintf(stderr, "mono_return_float8 s8.f3: got %f but expected %d\n", s8.f3, 3);
-		return 1;
 	}
 	if (s8.f4 != 4) {
 		fprintf(stderr, "mono_return_float8 s8.f4: got %f but expected %d\n", s8.f4, 4);
-		return 1;
 	}
 	if (s8.f5 != 5) {
 		fprintf(stderr, "mono_return_float8 s8.f5: got %f but expected %d\n", s8.f5, 5);
-		return 1;
 	}
 	if (s8.f6 != 6) {
 		fprintf(stderr, "mono_return_float8 s8.f6: got %f but expected %d\n", s8.f6, 6);
-		return 1;
 	}
 	if (s8.f7 != 7) {
 		fprintf(stderr, "mono_return_float8 s8.f7: got %f but expected %d\n", s8.f7, 7);
-		return 1;
 	}
 	if (s8.f8 != 8) {
 		fprintf(stderr, "mono_return_float8 s8.f8: got %f but expected %d\n", s8.f8, 8);
-		return 1;
 	}
-		return 2*addend;
+	s8.f1+=addend; s8.f2+=addend; s8.f3+=addend; s8.f4+=addend; s8.f5+=addend; s8.f6+=addend; s8.f7+=addend; s8.f8+=addend;
+	return s8;
 }
 
 typedef struct {
 	float f1,f2,f3,f4,f5,f6,f7,f8,f9;
 } float9;
 
-LIBTEST_API float STDCALL
+LIBTEST_API float9 STDCALL
 mono_return_float9 (float9 s9, int addend) {
 	if (s9.f1 != 1) {
 		fprintf(stderr, "mono_return_float9 s9.f1: got %f but expected %d\n", s9.f1, 1);
-		return 1;
 	}
 	if (s9.f2 != 2) {
 		fprintf(stderr, "mono_return_float9 s9.f2: got %f but expected %d\n", s9.f2, 2);
-		return 1;
 	}
 	if (s9.f3 != 3) {
 		fprintf(stderr, "mono_return_float9 s9.f3: got %f but expected %d\n", s9.f3, 3);
-		return 1;
 	}
 	if (s9.f4 != 4) {
 		fprintf(stderr, "mono_return_float9 s9.f4: got %f but expected %d\n", s9.f4, 4);
-		return 1;
 	}
 	if (s9.f5 != 5) {
 		fprintf(stderr, "mono_return_float9 s9.f5: got %f but expected %d\n", s9.f5, 5);
-		return 1;
 	}
 	if (s9.f6 != 6) {
 		fprintf(stderr, "mono_return_float9 s9.f6: got %f but expected %d\n", s9.f6, 6);
-		return 1;
 	}
 	if (s9.f7 != 7) {
 		fprintf(stderr, "mono_return_float9 s9.f7: got %f but expected %d\n", s9.f7, 7);
-		return 1;
 	}
 	if (s9.f8 != 8) {
 		fprintf(stderr, "mono_return_float9 s9.f8: got %f but expected %d\n", s9.f8, 8);
-		return 1;
 	}
 	if (s9.f9 != 9) {
 		fprintf(stderr, "mono_return_float9 s9.f9: got %f but expected %d\n", s9.f9, 9);
-		return 1;
 	}
-		return 2*addend;
+	s9.f1+=addend; s9.f2+=addend; s9.f3+=addend; s9.f4+=addend; s9.f5+=addend; s9.f6+=addend; s9.f7+=addend; s9.f8+=addend; s9.f9+=addend;
+	return s9;
+}
+
+typedef struct {
+	struct {
+		float f1;
+	} nested1;
+	float f2,f3;
+	struct {
+		float f4;
+	} nested2;
+} float4_nested;
+
+LIBTEST_API float4_nested STDCALL
+mono_return_float4_nested (float4_nested sn4, int addend) {
+	if (sn4.nested1.f1 != 1) {
+		fprintf(stderr, "mono_return_float4_nested sn4.nested1.f1: got %f but expected %d\n", sn4.nested1.f1, 1);
+	}
+	if (sn4.f2 != 2) {
+		fprintf(stderr, "mono_return_float4_nested sn4.f2: got %f but expected %d\n", sn4.f2, 2);
+	}
+	if (sn4.f3 != 3) {
+		fprintf(stderr, "mono_return_float4_nested sn4.f3: got %f but expected %d\n", sn4.f3, 3);
+	}
+	if (sn4.nested2.f4 != 4) {
+		fprintf(stderr, "mono_return_float4_nested sn4.nested2.f4: got %f but expected %d\n", sn4.nested2.f4, 4);
+	}
+	sn4.nested1.f1+=addend; sn4.f2+=addend; sn4.f3+=addend; sn4.nested2.f4+=addend;
+	return sn4;
 }
 
 typedef struct {
 	double f1;
 } double1;
 
-LIBTEST_API double STDCALL
+LIBTEST_API double1 STDCALL
 mono_return_double1 (double1 s1, int addend) {
 	if (s1.f1 != 1) {
 		fprintf(stderr, "mono_return_double1 s1.f1: got %f but expected %d\n", s1.f1, 1);
-		return 1;
 	}
-		return 2*addend;
+	s1.f1+=addend;
+	return s1;
 }
 
 typedef struct {
 	double f1,f2;
 } double2;
 
-LIBTEST_API double STDCALL
+LIBTEST_API double2 STDCALL
 mono_return_double2 (double2 s2, int addend) {
 	if (s2.f1 != 1) {
 		fprintf(stderr, "mono_return_double2 s2.f1: got %f but expected %d\n", s2.f1, 1);
-		return 1;
 	}
 	if (s2.f2 != 2) {
 		fprintf(stderr, "mono_return_double2 s2.f2: got %f but expected %d\n", s2.f2, 2);
-		return 1;
 	}
-		return 2*addend;
+	s2.f1+=addend; s2.f2+=addend;
+	return s2;
 }
 
 typedef struct {
 	double f1,f2,f3;
 } double3;
 
-LIBTEST_API double STDCALL
+LIBTEST_API double3 STDCALL
 mono_return_double3 (double3 s3, int addend) {
 	if (s3.f1 != 1) {
 		fprintf(stderr, "mono_return_double3 s3.f1: got %f but expected %d\n", s3.f1, 1);
-		return 1;
 	}
 	if (s3.f2 != 2) {
 		fprintf(stderr, "mono_return_double3 s3.f2: got %f but expected %d\n", s3.f2, 2);
-		return 1;
 	}
 	if (s3.f3 != 3) {
 		fprintf(stderr, "mono_return_double3 s3.f3: got %f but expected %d\n", s3.f3, 3);
-		return 1;
 	}
-		return 2*addend;
+	s3.f1+=addend; s3.f2+=addend; s3.f3+=addend;
+	return s3;
 }
 
 typedef struct {
 	double f1,f2,f3,f4;
 } double4;
 
-LIBTEST_API double STDCALL
+LIBTEST_API double4 STDCALL
 mono_return_double4 (double4 s4, int addend) {
 	if (s4.f1 != 1) {
 		fprintf(stderr, "mono_return_double4 s4.f1: got %f but expected %d\n", s4.f1, 1);
-		return 1;
 	}
 	if (s4.f2 != 2) {
 		fprintf(stderr, "mono_return_double4 s4.f2: got %f but expected %d\n", s4.f2, 2);
-		return 1;
 	}
 	if (s4.f3 != 3) {
 		fprintf(stderr, "mono_return_double4 s4.f3: got %f but expected %d\n", s4.f3, 3);
-		return 1;
 	}
 	if (s4.f4 != 4) {
 		fprintf(stderr, "mono_return_double4 s4.f4: got %f but expected %d\n", s4.f4, 4);
-		return 1;
 	}
-		return 2*addend;
+	s4.f1+=addend; s4.f2+=addend; s4.f3+=addend; s4.f4+=addend;
+	return s4;
 }
 
 typedef struct {
 	double f1,f2,f3,f4,f5;
 } double5;
 
-LIBTEST_API double STDCALL
+LIBTEST_API double5 STDCALL
 mono_return_double5 (double5 s5, int addend) {
 	if (s5.f1 != 1) {
 		fprintf(stderr, "mono_return_double5 s5.f1: got %f but expected %d\n", s5.f1, 1);
-		return 1;
 	}
 	if (s5.f2 != 2) {
 		fprintf(stderr, "mono_return_double5 s5.f2: got %f but expected %d\n", s5.f2, 2);
-		return 1;
 	}
 	if (s5.f3 != 3) {
 		fprintf(stderr, "mono_return_double5 s5.f3: got %f but expected %d\n", s5.f3, 3);
-		return 1;
 	}
 	if (s5.f4 != 4) {
 		fprintf(stderr, "mono_return_double5 s5.f4: got %f but expected %d\n", s5.f4, 4);
-		return 1;
 	}
 	if (s5.f5 != 5) {
 		fprintf(stderr, "mono_return_double5 s5.f5: got %f but expected %d\n", s5.f5, 5);
-		return 1;
 	}
-		return 2*addend;
+	s5.f1+=addend; s5.f2+=addend; s5.f3+=addend; s5.f4+=addend; s5.f5+=addend;
+	return s5;
 }
 
 typedef struct {
 	double f1,f2,f3,f4,f5,f6;
 } double6;
 
-LIBTEST_API double STDCALL
+LIBTEST_API double6 STDCALL
 mono_return_double6 (double6 s6, int addend) {
 	if (s6.f1 != 1) {
 		fprintf(stderr, "mono_return_double6 s6.f1: got %f but expected %d\n", s6.f1, 1);
-		return 1;
 	}
 	if (s6.f2 != 2) {
 		fprintf(stderr, "mono_return_double6 s6.f2: got %f but expected %d\n", s6.f2, 2);
-		return 1;
 	}
 	if (s6.f3 != 3) {
 		fprintf(stderr, "mono_return_double6 s6.f3: got %f but expected %d\n", s6.f3, 3);
-		return 1;
 	}
 	if (s6.f4 != 4) {
 		fprintf(stderr, "mono_return_double6 s6.f4: got %f but expected %d\n", s6.f4, 4);
-		return 1;
 	}
 	if (s6.f5 != 5) {
 		fprintf(stderr, "mono_return_double6 s6.f5: got %f but expected %d\n", s6.f5, 5);
-		return 1;
 	}
 	if (s6.f6 != 6) {
 		fprintf(stderr, "mono_return_double6 s6.f6: got %f but expected %d\n", s6.f6, 6);
-		return 1;
 	}
-		return 2*addend;
+	s6.f1+=addend; s6.f2+=addend; s6.f3+=addend; s6.f4+=addend; s6.f5+=addend; s6.f6+=addend;
+	return s6;
 }
 
 typedef struct {
 	double f1,f2,f3,f4,f5,f6,f7;
 } double7;
 
-LIBTEST_API double STDCALL
+LIBTEST_API double7 STDCALL
 mono_return_double7 (double7 s7, int addend) {
 	if (s7.f1 != 1) {
 		fprintf(stderr, "mono_return_double7 s7.f1: got %f but expected %d\n", s7.f1, 1);
-		return 1;
 	}
 	if (s7.f2 != 2) {
 		fprintf(stderr, "mono_return_double7 s7.f2: got %f but expected %d\n", s7.f2, 2);
-		return 1;
 	}
 	if (s7.f3 != 3) {
 		fprintf(stderr, "mono_return_double7 s7.f3: got %f but expected %d\n", s7.f3, 3);
-		return 1;
 	}
 	if (s7.f4 != 4) {
 		fprintf(stderr, "mono_return_double7 s7.f4: got %f but expected %d\n", s7.f4, 4);
-		return 1;
 	}
 	if (s7.f5 != 5) {
 		fprintf(stderr, "mono_return_double7 s7.f5: got %f but expected %d\n", s7.f5, 5);
-		return 1;
 	}
 	if (s7.f6 != 6) {
 		fprintf(stderr, "mono_return_double7 s7.f6: got %f but expected %d\n", s7.f6, 6);
-		return 1;
 	}
 	if (s7.f7 != 7) {
 		fprintf(stderr, "mono_return_double7 s7.f7: got %f but expected %d\n", s7.f7, 7);
-		return 1;
 	}
-		return 2*addend;
+	s7.f1+=addend; s7.f2+=addend; s7.f3+=addend; s7.f4+=addend; s7.f5+=addend; s7.f6+=addend; s7.f7+=addend;
+	return s7;
 }
 
 typedef struct {
 	double f1,f2,f3,f4,f5,f6,f7,f8;
 } double8;
 
-LIBTEST_API double STDCALL
+LIBTEST_API double8 STDCALL
 mono_return_double8 (double8 s8, int addend) {
 	if (s8.f1 != 1) {
 		fprintf(stderr, "mono_return_double8 s8.f1: got %f but expected %d\n", s8.f1, 1);
-		return 1;
 	}
 	if (s8.f2 != 2) {
 		fprintf(stderr, "mono_return_double8 s8.f2: got %f but expected %d\n", s8.f2, 2);
-		return 1;
 	}
 	if (s8.f3 != 3) {
 		fprintf(stderr, "mono_return_double8 s8.f3: got %f but expected %d\n", s8.f3, 3);
-		return 1;
 	}
 	if (s8.f4 != 4) {
 		fprintf(stderr, "mono_return_double8 s8.f4: got %f but expected %d\n", s8.f4, 4);
-		return 1;
 	}
 	if (s8.f5 != 5) {
 		fprintf(stderr, "mono_return_double8 s8.f5: got %f but expected %d\n", s8.f5, 5);
-		return 1;
 	}
 	if (s8.f6 != 6) {
 		fprintf(stderr, "mono_return_double8 s8.f6: got %f but expected %d\n", s8.f6, 6);
-		return 1;
 	}
 	if (s8.f7 != 7) {
 		fprintf(stderr, "mono_return_double8 s8.f7: got %f but expected %d\n", s8.f7, 7);
-		return 1;
 	}
 	if (s8.f8 != 8) {
 		fprintf(stderr, "mono_return_double8 s8.f8: got %f but expected %d\n", s8.f8, 8);
-		return 1;
 	}
-		return 2*addend;
+	s8.f1+=addend; s8.f2+=addend; s8.f3+=addend; s8.f4+=addend; s8.f5+=addend; s8.f6+=addend; s8.f7+=addend; s8.f8+=addend;
+	return s8;
 }
 
 typedef struct {
 	double f1,f2,f3,f4,f5,f6,f7,f8,f9;
 } double9;
 
-LIBTEST_API double STDCALL
+LIBTEST_API double9 STDCALL
 mono_return_double9 (double9 s9, int addend) {
 	if (s9.f1 != 1) {
 		fprintf(stderr, "mono_return_double9 s9.f1: got %f but expected %d\n", s9.f1, 1);
-		return 1;
 	}
 	if (s9.f2 != 2) {
 		fprintf(stderr, "mono_return_double9 s9.f2: got %f but expected %d\n", s9.f2, 2);
-		return 1;
 	}
 	if (s9.f3 != 3) {
 		fprintf(stderr, "mono_return_double9 s9.f3: got %f but expected %d\n", s9.f3, 3);
-		return 1;
 	}
 	if (s9.f4 != 4) {
 		fprintf(stderr, "mono_return_double9 s9.f4: got %f but expected %d\n", s9.f4, 4);
-		return 1;
 	}
 	if (s9.f5 != 5) {
 		fprintf(stderr, "mono_return_double9 s9.f5: got %f but expected %d\n", s9.f5, 5);
-		return 1;
 	}
 	if (s9.f6 != 6) {
 		fprintf(stderr, "mono_return_double9 s9.f6: got %f but expected %d\n", s9.f6, 6);
-		return 1;
 	}
 	if (s9.f7 != 7) {
 		fprintf(stderr, "mono_return_double9 s9.f7: got %f but expected %d\n", s9.f7, 7);
-		return 1;
 	}
 	if (s9.f8 != 8) {
 		fprintf(stderr, "mono_return_double9 s9.f8: got %f but expected %d\n", s9.f8, 8);
-		return 1;
 	}
 	if (s9.f9 != 9) {
 		fprintf(stderr, "mono_return_double9 s9.f9: got %f but expected %d\n", s9.f9, 9);
-		return 1;
 	}
-		return 2*addend;
+	s9.f1+=addend; s9.f2+=addend; s9.f3+=addend; s9.f4+=addend; s9.f5+=addend; s9.f6+=addend; s9.f7+=addend; s9.f8+=addend; s9.f9+=addend;
+	return s9;
 }
 
+typedef struct {
+	struct {
+		double f1;
+	} nested1;
+	struct {
+		double f2;
+	} nested2;
+} double2_nested;
+
+LIBTEST_API double2_nested STDCALL
+mono_return_double2_nested (double2_nested sn2, int addend) {
+	if (sn2.nested1.f1 != 1) {
+		fprintf(stderr, "mono_return_double2_nested sn2.nested1.f1: got %f but expected %d\n", sn2.nested1.f1, 1);
+	}
+	if (sn2.nested2.f2 != 2) {
+		fprintf(stderr, "mono_return_double2_nested sn2.nested2.f2: got %f but expected %d\n", sn2.nested2.f2, 2);
+	}
+	sn2.nested1.f1+=addend; sn2.nested2.f2+=addend;
+	return sn2;
+}
 
 
-// WDS debug
-// To use add:
-//	[DllImport ("libtest", EntryPoint="ppc_dbg")]
-//	public static extern void ppc_dbg ();
-// Then just call:
-//	ppc_dbg();
-LIBTEST_API void STDCALL
-ppc_dbg(void)
-{
-	static int cnt=0;
-        ++cnt;
-	printf("@#@#@# ppc_dbg call#%d\n", cnt);
-	return;
+
+typedef struct {
+	double f1[4];
+} double_array4;
+
+LIBTEST_API double_array4 STDCALL
+mono_return_double_array4 (double_array4 sa4, int addend) {
+	if (sa4.f1[0] != 1) {
+		fprintf(stderr, "mono_return_double_array4 sa4.f1[0]: got %f but expected %d\n", sa4.f1[0], 1);
+	}
+	if (sa4.f1[1] != 2) {
+		fprintf(stderr, "mono_return_double_array4 sa4.f1[1]: got %f but expected %d\n", sa4.f1[1], 2);
+	}
+	if (sa4.f1[2] != 3) {
+		fprintf(stderr, "mono_return_double_array4 sa4.f1[2]: got %f but expected %d\n", sa4.f1[2], 3);
+	}
+	if (sa4.f1[3] != 4) {
+		fprintf(stderr, "mono_return_double_array4 sa4.f1[3]: got %f but expected %d\n", sa4.f1[3], 4);
+	}
+	sa4.f1[0]+=addend; sa4.f1[1]+=addend; sa4.f1[2]+=addend; sa4.f1[3]+=addend;
+	return sa4;
 }
-// WDS debug
 
Index: mono-4.2.1/mono/tests/pinvoke_ppcc.cs
===================================================================
--- mono-4.2.1.orig/mono/tests/pinvoke_ppcc.cs
+++ mono-4.2.1/mono/tests/pinvoke_ppcc.cs
@@ -20,97 +20,97 @@ using System.Runtime.InteropServices;
 public class Test_sbyte {
 
 	[DllImport ("libtest", EntryPoint="mono_return_sbyte1")]
-	public static extern sbyte mono_return_sbyte1 (sbyte1 s, int addend);
+	public static extern sbyte1 mono_return_sbyte1 (sbyte1 s, int addend);
 	[StructLayout(LayoutKind.Sequential)]
 	public struct sbyte1 {
 		public sbyte f1;
 	}
 	[DllImport ("libtest", EntryPoint="mono_return_sbyte2")]
-	public static extern sbyte mono_return_sbyte2 (sbyte2 s, int addend);
+	public static extern sbyte2 mono_return_sbyte2 (sbyte2 s, int addend);
 	[StructLayout(LayoutKind.Sequential)]
 	public struct sbyte2 {
 		public sbyte f1,f2;
 	}
 	[DllImport ("libtest", EntryPoint="mono_return_sbyte3")]
-	public static extern sbyte mono_return_sbyte3 (sbyte3 s, int addend);
+	public static extern sbyte3 mono_return_sbyte3 (sbyte3 s, int addend);
 	[StructLayout(LayoutKind.Sequential)]
 	public struct sbyte3 {
 		public sbyte f1,f2,f3;
 	}
 	[DllImport ("libtest", EntryPoint="mono_return_sbyte4")]
-	public static extern sbyte mono_return_sbyte4 (sbyte4 s, int addend);
+	public static extern sbyte4 mono_return_sbyte4 (sbyte4 s, int addend);
 	[StructLayout(LayoutKind.Sequential)]
 	public struct sbyte4 {
 		public sbyte f1,f2,f3,f4;
 	}
 	[DllImport ("libtest", EntryPoint="mono_return_sbyte5")]
-	public static extern sbyte mono_return_sbyte5 (sbyte5 s, int addend);
+	public static extern sbyte5 mono_return_sbyte5 (sbyte5 s, int addend);
 	[StructLayout(LayoutKind.Sequential)]
 	public struct sbyte5 {
 		public sbyte f1,f2,f3,f4,f5;
 	}
 	[DllImport ("libtest", EntryPoint="mono_return_sbyte6")]
-	public static extern sbyte mono_return_sbyte6 (sbyte6 s, int addend);
+	public static extern sbyte6 mono_return_sbyte6 (sbyte6 s, int addend);
 	[StructLayout(LayoutKind.Sequential)]
 	public struct sbyte6 {
 		public sbyte f1,f2,f3,f4,f5,f6;
 	}
 	[DllImport ("libtest", EntryPoint="mono_return_sbyte7")]
-	public static extern sbyte mono_return_sbyte7 (sbyte7 s, int addend);
+	public static extern sbyte7 mono_return_sbyte7 (sbyte7 s, int addend);
 	[StructLayout(LayoutKind.Sequential)]
 	public struct sbyte7 {
 		public sbyte f1,f2,f3,f4,f5,f6,f7;
 	}
 	[DllImport ("libtest", EntryPoint="mono_return_sbyte8")]
-	public static extern sbyte mono_return_sbyte8 (sbyte8 s, int addend);
+	public static extern sbyte8 mono_return_sbyte8 (sbyte8 s, int addend);
 	[StructLayout(LayoutKind.Sequential)]
 	public struct sbyte8 {
 		public sbyte f1,f2,f3,f4,f5,f6,f7,f8;
 	}
 	[DllImport ("libtest", EntryPoint="mono_return_sbyte9")]
-	public static extern sbyte mono_return_sbyte9 (sbyte9 s, int addend);
+	public static extern sbyte9 mono_return_sbyte9 (sbyte9 s, int addend);
 	[StructLayout(LayoutKind.Sequential)]
 	public struct sbyte9 {
 		public sbyte f1,f2,f3,f4,f5,f6,f7,f8,f9;
 	}
 	[DllImport ("libtest", EntryPoint="mono_return_sbyte10")]
-	public static extern sbyte mono_return_sbyte10 (sbyte10 s, int addend);
+	public static extern sbyte10 mono_return_sbyte10 (sbyte10 s, int addend);
 	[StructLayout(LayoutKind.Sequential)]
 	public struct sbyte10 {
 		public sbyte f1,f2,f3,f4,f5,f6,f7,f8,f9,f10;
 	}
 	[DllImport ("libtest", EntryPoint="mono_return_sbyte11")]
-	public static extern sbyte mono_return_sbyte11 (sbyte11 s, int addend);
+	public static extern sbyte11 mono_return_sbyte11 (sbyte11 s, int addend);
 	[StructLayout(LayoutKind.Sequential)]
 	public struct sbyte11 {
 		public sbyte f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11;
 	}
 	[DllImport ("libtest", EntryPoint="mono_return_sbyte12")]
-	public static extern sbyte mono_return_sbyte12 (sbyte12 s, int addend);
+	public static extern sbyte12 mono_return_sbyte12 (sbyte12 s, int addend);
 	[StructLayout(LayoutKind.Sequential)]
 	public struct sbyte12 {
 		public sbyte f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12;
 	}
 	[DllImport ("libtest", EntryPoint="mono_return_sbyte13")]
-	public static extern sbyte mono_return_sbyte13 (sbyte13 s, int addend);
+	public static extern sbyte13 mono_return_sbyte13 (sbyte13 s, int addend);
 	[StructLayout(LayoutKind.Sequential)]
 	public struct sbyte13 {
 		public sbyte f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13;
 	}
 	[DllImport ("libtest", EntryPoint="mono_return_sbyte14")]
-	public static extern sbyte mono_return_sbyte14 (sbyte14 s, int addend);
+	public static extern sbyte14 mono_return_sbyte14 (sbyte14 s, int addend);
 	[StructLayout(LayoutKind.Sequential)]
 	public struct sbyte14 {
 		public sbyte f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14;
 	}
 	[DllImport ("libtest", EntryPoint="mono_return_sbyte15")]
-	public static extern sbyte mono_return_sbyte15 (sbyte15 s, int addend);
+	public static extern sbyte15 mono_return_sbyte15 (sbyte15 s, int addend);
 	[StructLayout(LayoutKind.Sequential)]
 	public struct sbyte15 {
 		public sbyte f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15;
 	}
 	[DllImport ("libtest", EntryPoint="mono_return_sbyte16")]
-	public static extern sbyte mono_return_sbyte16 (sbyte16 s, int addend);
+	public static extern sbyte16 mono_return_sbyte16 (sbyte16 s, int addend);
 	[StructLayout(LayoutKind.Sequential)]
 	public struct sbyte16 {
 		public sbyte f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15,f16;
@@ -118,7 +118,7 @@ public class Test_sbyte {
 	// This structure is 1 element too large to use the special return
 	//  rules.
 	[DllImport ("libtest", EntryPoint="mono_return_sbyte17")]
-	public static extern sbyte mono_return_sbyte17 (sbyte17 s, int addend);
+	public static extern sbyte17 mono_return_sbyte17 (sbyte17 s, int addend);
 	[StructLayout(LayoutKind.Sequential)]
 	public struct sbyte17 {
 		public sbyte f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15,f16,f17;
@@ -145,41 +145,66 @@ public class Test_sbyte {
 
 		sbyte1 s1;
 		s1.f1 = 1;
-		sbyte retval1 = mono_return_sbyte1(s1, 9);
-		if (retval1 != 2*9) {
-			Console.WriteLine("   sbyte1 retval1: got {0} but expected {1}", retval1, 2*9);
+		s1 = mono_return_sbyte1(s1, 9);
+
+		if (s1.f1 != 1+9) {
+			Console.WriteLine("   sbyte1 s1.f1: got {0} but expected {1}", s1.f1, 1+9);
 			return 1;
 		}
 
 		sbyte2 s2;
 		s2.f1 = 1;
 		s2.f2 = 2;
-		sbyte retval2 = mono_return_sbyte2(s2, 9);
-		if (retval2 != 2*9) {
-			Console.WriteLine("   sbyte2 retval2: got {0} but expected {1}", retval2, 2*9);
+		s2 = mono_return_sbyte2(s2, 9);
+		if (s2.f1 != 1+9) {
+			Console.WriteLine("   sbyte2 s2.f1: got {0} but expected {1}", s2.f1, 1+9);
 			return 1;
 		}
+		if (s2.f2 != 2+9) {
+			Console.WriteLine("   sbyte2 s2.f2: got {0} but expected {1}", s2.f2, 2+9);
+			return 2;
+		}
 
 		sbyte3 s3;
 		s3.f1 = 1;
 		s3.f2 = 2;
 		s3.f3 = 3;
-		sbyte retval3 = mono_return_sbyte3(s3, 9);
-		if (retval3 != 2*9) {
-			Console.WriteLine("   sbyte3 retval3: got {0} but expected {1}", retval3, 2*9);
+		s3 = mono_return_sbyte3(s3, 9);
+		if (s3.f1 != 1+9) {
+			Console.WriteLine("   sbyte3 s3.f1: got {0} but expected {1}", s3.f1, 1+9);
 			return 1;
 		}
+		if (s3.f2 != 2+9) {
+			Console.WriteLine("   sbyte3 s3.f2: got {0} but expected {1}", s3.f2, 2+9);
+			return 2;
+		}
+		if (s3.f3 != 3+9) {
+			Console.WriteLine("   sbyte3 s3.f3: got {0} but expected {1}", s3.f3, 3+9);
+			return 3;
+		}
 
 		sbyte4 s4;
 		s4.f1 = 1;
 		s4.f2 = 2;
 		s4.f3 = 3;
 		s4.f4 = 4;
-		sbyte retval4 = mono_return_sbyte4(s4, 9);
-		if (retval4 != 2*9) {
-			Console.WriteLine("   sbyte4 retval4: got {0} but expected {1}", retval4, 2*9);
+		s4 = mono_return_sbyte4(s4, 9);
+		if (s4.f1 != 1+9) {
+			Console.WriteLine("   sbyte4 s4.f1: got {0} but expected {1}", s4.f1, 1+9);
 			return 1;
 		}
+		if (s4.f2 != 2+9) {
+			Console.WriteLine("   sbyte4 s4.f2: got {0} but expected {1}", s4.f2, 2+9);
+			return 2;
+		}
+		if (s4.f3 != 3+9) {
+			Console.WriteLine("   sbyte4 s4.f3: got {0} but expected {1}", s4.f3, 3+9);
+			return 3;
+		}
+		if (s4.f4 != 4+9) {
+			Console.WriteLine("   sbyte4 s4.f4: got {0} but expected {1}", s4.f4, 4+9);
+			return 4;
+		}
 
 		sbyte5 s5;
 		s5.f1 = 1;
@@ -187,11 +212,27 @@ public class Test_sbyte {
 		s5.f3 = 3;
 		s5.f4 = 4;
 		s5.f5 = 5;
-		sbyte retval5 = mono_return_sbyte5(s5, 9);
-		if (retval5 != 2*9) {
-			Console.WriteLine("   sbyte5 retval5: got {0} but expected {1}", retval5, 2*9);
+		s5 = mono_return_sbyte5(s5, 9);
+		if (s5.f1 != 1+9) {
+			Console.WriteLine("   sbyte5 s5.f1: got {0} but expected {1}", s5.f1, 1+9);
 			return 1;
 		}
+		if (s5.f2 != 2+9) {
+			Console.WriteLine("   sbyte5 s5.f2: got {0} but expected {1}", s5.f2, 2+9);
+			return 2;
+		}
+		if (s5.f3 != 3+9) {
+			Console.WriteLine("   sbyte5 s5.f3: got {0} but expected {1}", s5.f3, 3+9);
+			return 3;
+		}
+		if (s5.f4 != 4+9) {
+			Console.WriteLine("   sbyte5 s5.f4: got {0} but expected {1}", s5.f4, 4+9);
+			return 4;
+		}
+		if (s5.f5 != 5+9) {
+			Console.WriteLine("   sbyte5 s5.f5: got {0} but expected {1}", s5.f5, 5+9);
+			return 5;
+		}
 
 		sbyte6 s6;
 		s6.f1 = 1;
@@ -200,11 +241,31 @@ public class Test_sbyte {
 		s6.f4 = 4;
 		s6.f5 = 5;
 		s6.f6 = 6;
-		sbyte retval6 = mono_return_sbyte6(s6, 9);
-		if (retval6 != 2*9) {
-			Console.WriteLine("   sbyte6 retval6: got {0} but expected {1}", retval6, 2*9);
+		s6 = mono_return_sbyte6(s6, 9);
+		if (s6.f1 != 1+9) {
+			Console.WriteLine("   sbyte6 s6.f1: got {0} but expected {1}", s6.f1, 1+9);
 			return 1;
 		}
+		if (s6.f2 != 2+9) {
+			Console.WriteLine("   sbyte6 s6.f2: got {0} but expected {1}", s6.f2, 2+9);
+			return 2;
+		}
+		if (s6.f3 != 3+9) {
+			Console.WriteLine("   sbyte6 s6.f3: got {0} but expected {1}", s6.f3, 3+9);
+			return 3;
+		}
+		if (s6.f4 != 4+9) {
+			Console.WriteLine("   sbyte6 s6.f4: got {0} but expected {1}", s6.f4, 4+9);
+			return 4;
+		}
+		if (s6.f5 != 5+9) {
+			Console.WriteLine("   sbyte6 s6.f5: got {0} but expected {1}", s6.f5, 5+9);
+			return 5;
+		}
+		if (s6.f6 != 6+9) {
+			Console.WriteLine("   sbyte6 s6.f6: got {0} but expected {1}", s6.f6, 6+9);
+			return 6;
+		}
 
 		sbyte7 s7;
 		s7.f1 = 1;
@@ -214,11 +275,35 @@ public class Test_sbyte {
 		s7.f5 = 5;
 		s7.f6 = 6;
 		s7.f7 = 7;
-		sbyte retval7 = mono_return_sbyte7(s7, 9);
-		if (retval7 != 2*9) {
-			Console.WriteLine("   sbyte7 retval7: got {0} but expected {1}", retval7, 2*9);
+		s7 = mono_return_sbyte7(s7, 9);
+		if (s7.f1 != 1+9) {
+			Console.WriteLine("   sbyte7 s7.f1: got {0} but expected {1}", s7.f1, 1+9);
 			return 1;
 		}
+		if (s7.f2 != 2+9) {
+			Console.WriteLine("   sbyte7 s7.f2: got {0} but expected {1}", s7.f2, 2+9);
+			return 2;
+		}
+		if (s7.f3 != 3+9) {
+			Console.WriteLine("   sbyte7 s7.f3: got {0} but expected {1}", s7.f3, 3+9);
+			return 3;
+		}
+		if (s7.f4 != 4+9) {
+			Console.WriteLine("   sbyte7 s7.f4: got {0} but expected {1}", s7.f4, 4+9);
+			return 4;
+		}
+		if (s7.f5 != 5+9) {
+			Console.WriteLine("   sbyte7 s7.f5: got {0} but expected {1}", s7.f5, 5+9);
+			return 5;
+		}
+		if (s7.f6 != 6+9) {
+			Console.WriteLine("   sbyte7 s7.f6: got {0} but expected {1}", s7.f6, 6+9);
+			return 6;
+		}
+		if (s7.f7 != 7+9) {
+			Console.WriteLine("   sbyte7 s7.f7: got {0} but expected {1}", s7.f7, 7+9);
+			return 7;
+		}
 
 		sbyte8 s8;
 		s8.f1 = 1;
@@ -229,11 +314,39 @@ public class Test_sbyte {
 		s8.f6 = 6;
 		s8.f7 = 7;
 		s8.f8 = 8;
-		sbyte retval8 = mono_return_sbyte8(s8, 9);
-		if (retval8 != 2*9) {
-			Console.WriteLine("   sbyte8 retval8: got {0} but expected {1}", retval8, 2*9);
+		s8 = mono_return_sbyte8(s8, 9);
+		if (s8.f1 != 1+9) {
+			Console.WriteLine("   sbyte8 s8.f1: got {0} but expected {1}", s8.f1, 1+9);
 			return 1;
 		}
+		if (s8.f2 != 2+9) {
+			Console.WriteLine("   sbyte8 s8.f2: got {0} but expected {1}", s8.f2, 2+9);
+			return 2;
+		}
+		if (s8.f3 != 3+9) {
+			Console.WriteLine("   sbyte8 s8.f3: got {0} but expected {1}", s8.f3, 3+9);
+			return 3;
+		}
+		if (s8.f4 != 4+9) {
+			Console.WriteLine("   sbyte8 s8.f4: got {0} but expected {1}", s8.f4, 4+9);
+			return 4;
+		}
+		if (s8.f5 != 5+9) {
+			Console.WriteLine("   sbyte8 s8.f5: got {0} but expected {1}", s8.f5, 5+9);
+			return 5;
+		}
+		if (s8.f6 != 6+9) {
+			Console.WriteLine("   sbyte8 s8.f6: got {0} but expected {1}", s8.f6, 6+9);
+			return 6;
+		}
+		if (s8.f7 != 7+9) {
+			Console.WriteLine("   sbyte8 s8.f7: got {0} but expected {1}", s8.f7, 7+9);
+			return 7;
+		}
+		if (s8.f8 != 8+9) {
+			Console.WriteLine("   sbyte8 s8.f8: got {0} but expected {1}", s8.f8, 8+9);
+			return 8;
+		}
 
 		sbyte9 s9;
 		s9.f1 = 1;
@@ -245,11 +358,43 @@ public class Test_sbyte {
 		s9.f7 = 7;
 		s9.f8 = 8;
 		s9.f9 = 9;
-		sbyte retval9 = mono_return_sbyte9(s9, 9);
-		if (retval9 != 2*9) {
-			Console.WriteLine("   sbyte9 retval9: got {0} but expected {1}", retval9, 2*9);
+		s9 = mono_return_sbyte9(s9, 9);
+		if (s9.f1 != 1+9) {
+			Console.WriteLine("   sbyte9 s9.f1: got {0} but expected {1}", s9.f1, 1+9);
 			return 1;
 		}
+		if (s9.f2 != 2+9) {
+			Console.WriteLine("   sbyte9 s9.f2: got {0} but expected {1}", s9.f2, 2+9);
+			return 2;
+		}
+		if (s9.f3 != 3+9) {
+			Console.WriteLine("   sbyte9 s9.f3: got {0} but expected {1}", s9.f3, 3+9);
+			return 3;
+		}
+		if (s9.f4 != 4+9) {
+			Console.WriteLine("   sbyte9 s9.f4: got {0} but expected {1}", s9.f4, 4+9);
+			return 4;
+		}
+		if (s9.f5 != 5+9) {
+			Console.WriteLine("   sbyte9 s9.f5: got {0} but expected {1}", s9.f5, 5+9);
+			return 5;
+		}
+		if (s9.f6 != 6+9) {
+			Console.WriteLine("   sbyte9 s9.f6: got {0} but expected {1}", s9.f6, 6+9);
+			return 6;
+		}
+		if (s9.f7 != 7+9) {
+			Console.WriteLine("   sbyte9 s9.f7: got {0} but expected {1}", s9.f7, 7+9);
+			return 7;
+		}
+		if (s9.f8 != 8+9) {
+			Console.WriteLine("   sbyte9 s9.f8: got {0} but expected {1}", s9.f8, 8+9);
+			return 8;
+		}
+		if (s9.f9 != 9+9) {
+			Console.WriteLine("   sbyte9 s9.f9: got {0} but expected {1}", s9.f9, 9+9);
+			return 9;
+		}
 
 		sbyte10 s10;
 		s10.f1 = 1;
@@ -262,11 +407,47 @@ public class Test_sbyte {
 		s10.f8 = 8;
 		s10.f9 = 9;
 		s10.f10 = 10;
-		sbyte retval10 = mono_return_sbyte10(s10, 9);
-		if (retval10 != 2*9) {
-			Console.WriteLine("   sbyte10 retval10: got {0} but expected {1}", retval10, 2*9);
+		s10 = mono_return_sbyte10(s10, 9);
+		if (s10.f1 != 1+9) {
+			Console.WriteLine("   sbyte10 s10.f1: got {0} but expected {1}", s10.f1, 1+9);
 			return 1;
 		}
+		if (s10.f2 != 2+9) {
+			Console.WriteLine("   sbyte10 s10.f2: got {0} but expected {1}", s10.f2, 2+9);
+			return 2;
+		}
+		if (s10.f3 != 3+9) {
+			Console.WriteLine("   sbyte10 s10.f3: got {0} but expected {1}", s10.f3, 3+9);
+			return 3;
+		}
+		if (s10.f4 != 4+9) {
+			Console.WriteLine("   sbyte10 s10.f4: got {0} but expected {1}", s10.f4, 4+9);
+			return 4;
+		}
+		if (s10.f5 != 5+9) {
+			Console.WriteLine("   sbyte10 s10.f5: got {0} but expected {1}", s10.f5, 5+9);
+			return 5;
+		}
+		if (s10.f6 != 6+9) {
+			Console.WriteLine("   sbyte10 s10.f6: got {0} but expected {1}", s10.f6, 6+9);
+			return 6;
+		}
+		if (s10.f7 != 7+9) {
+			Console.WriteLine("   sbyte10 s10.f7: got {0} but expected {1}", s10.f7, 7+9);
+			return 7;
+		}
+		if (s10.f8 != 8+9) {
+			Console.WriteLine("   sbyte10 s10.f8: got {0} but expected {1}", s10.f8, 8+9);
+			return 8;
+		}
+		if (s10.f9 != 9+9) {
+			Console.WriteLine("   sbyte10 s10.f9: got {0} but expected {1}", s10.f9, 9+9);
+			return 9;
+		}
+		if (s10.f10 != 10+9) {
+			Console.WriteLine("   sbyte10 s10.f10: got {0} but expected {1}", s10.f10, 10+9);
+			return 10;
+		}
 
 		sbyte11 s11;
 		s11.f1 = 1;
@@ -280,11 +461,51 @@ public class Test_sbyte {
 		s11.f9 = 9;
 		s11.f10 = 10;
 		s11.f11 = 11;
-		sbyte retval11 = mono_return_sbyte11(s11, 9);
-		if (retval11 != 2*9) {
-			Console.WriteLine("   sbyte11 retval11: got {0} but expected {1}", retval11, 2*9);
+		s11 = mono_return_sbyte11(s11, 9);
+		if (s11.f1 != 1+9) {
+			Console.WriteLine("   sbyte11 s11.f1: got {0} but expected {1}", s11.f1, 1+9);
 			return 1;
 		}
+		if (s11.f2 != 2+9) {
+			Console.WriteLine("   sbyte11 s11.f2: got {0} but expected {1}", s11.f2, 2+9);
+			return 2;
+		}
+		if (s11.f3 != 3+9) {
+			Console.WriteLine("   sbyte11 s11.f3: got {0} but expected {1}", s11.f3, 3+9);
+			return 3;
+		}
+		if (s11.f4 != 4+9) {
+			Console.WriteLine("   sbyte11 s11.f4: got {0} but expected {1}", s11.f4, 4+9);
+			return 4;
+		}
+		if (s11.f5 != 5+9) {
+			Console.WriteLine("   sbyte11 s11.f5: got {0} but expected {1}", s11.f5, 5+9);
+			return 5;
+		}
+		if (s11.f6 != 6+9) {
+			Console.WriteLine("   sbyte11 s11.f6: got {0} but expected {1}", s11.f6, 6+9);
+			return 6;
+		}
+		if (s11.f7 != 7+9) {
+			Console.WriteLine("   sbyte11 s11.f7: got {0} but expected {1}", s11.f7, 7+9);
+			return 7;
+		}
+		if (s11.f8 != 8+9) {
+			Console.WriteLine("   sbyte11 s11.f8: got {0} but expected {1}", s11.f8, 8+9);
+			return 8;
+		}
+		if (s11.f9 != 9+9) {
+			Console.WriteLine("   sbyte11 s11.f9: got {0} but expected {1}", s11.f9, 9+9);
+			return 9;
+		}
+		if (s11.f10 != 10+9) {
+			Console.WriteLine("   sbyte11 s11.f10: got {0} but expected {1}", s11.f10, 10+9);
+			return 10;
+		}
+		if (s11.f11 != 11+9) {
+			Console.WriteLine("   sbyte11 s11.f11: got {0} but expected {1}", s11.f11, 11+9);
+			return 11;
+		}
 
 		sbyte12 s12;
 		s12.f1 = 1;
@@ -299,11 +520,55 @@ public class Test_sbyte {
 		s12.f10 = 10;
 		s12.f11 = 11;
 		s12.f12 = 12;
-		sbyte retval12 = mono_return_sbyte12(s12, 9);
-		if (retval12 != 2*9) {
-			Console.WriteLine("   sbyte12 retval12: got {0} but expected {1}", retval12, 2*9);
+		s12 = mono_return_sbyte12(s12, 9);
+		if (s12.f1 != 1+9) {
+			Console.WriteLine("   sbyte12 s12.f1: got {0} but expected {1}", s12.f1, 1+9);
 			return 1;
 		}
+		if (s12.f2 != 2+9) {
+			Console.WriteLine("   sbyte12 s12.f2: got {0} but expected {1}", s12.f2, 2+9);
+			return 2;
+		}
+		if (s12.f3 != 3+9) {
+			Console.WriteLine("   sbyte12 s12.f3: got {0} but expected {1}", s12.f3, 3+9);
+			return 3;
+		}
+		if (s12.f4 != 4+9) {
+			Console.WriteLine("   sbyte12 s12.f4: got {0} but expected {1}", s12.f4, 4+9);
+			return 4;
+		}
+		if (s12.f5 != 5+9) {
+			Console.WriteLine("   sbyte12 s12.f5: got {0} but expected {1}", s12.f5, 5+9);
+			return 5;
+		}
+		if (s12.f6 != 6+9) {
+			Console.WriteLine("   sbyte12 s12.f6: got {0} but expected {1}", s12.f6, 6+9);
+			return 6;
+		}
+		if (s12.f7 != 7+9) {
+			Console.WriteLine("   sbyte12 s12.f7: got {0} but expected {1}", s12.f7, 7+9);
+			return 7;
+		}
+		if (s12.f8 != 8+9) {
+			Console.WriteLine("   sbyte12 s12.f8: got {0} but expected {1}", s12.f8, 8+9);
+			return 8;
+		}
+		if (s12.f9 != 9+9) {
+			Console.WriteLine("   sbyte12 s12.f9: got {0} but expected {1}", s12.f9, 9+9);
+			return 9;
+		}
+		if (s12.f10 != 10+9) {
+			Console.WriteLine("   sbyte12 s12.f10: got {0} but expected {1}", s12.f10, 10+9);
+			return 10;
+		}
+		if (s12.f11 != 11+9) {
+			Console.WriteLine("   sbyte12 s12.f11: got {0} but expected {1}", s12.f11, 11+9);
+			return 11;
+		}
+		if (s12.f12 != 12+9) {
+			Console.WriteLine("   sbyte12 s12.f12: got {0} but expected {1}", s12.f12, 12+9);
+			return 12;
+		}
 
 		sbyte13 s13;
 		s13.f1 = 1;
@@ -319,11 +584,59 @@ public class Test_sbyte {
 		s13.f11 = 11;
 		s13.f12 = 12;
 		s13.f13 = 13;
-		sbyte retval13 = mono_return_sbyte13(s13, 9);
-		if (retval13 != 2*9) {
-			Console.WriteLine("   sbyte13 retval13: got {0} but expected {1}", retval13, 2*9);
+		s13 = mono_return_sbyte13(s13, 9);
+		if (s13.f1 != 1+9) {
+			Console.WriteLine("   sbyte13 s13.f1: got {0} but expected {1}", s13.f1, 1+9);
 			return 1;
 		}
+		if (s13.f2 != 2+9) {
+			Console.WriteLine("   sbyte13 s13.f2: got {0} but expected {1}", s13.f2, 2+9);
+			return 2;
+		}
+		if (s13.f3 != 3+9) {
+			Console.WriteLine("   sbyte13 s13.f3: got {0} but expected {1}", s13.f3, 3+9);
+			return 3;
+		}
+		if (s13.f4 != 4+9) {
+			Console.WriteLine("   sbyte13 s13.f4: got {0} but expected {1}", s13.f4, 4+9);
+			return 4;
+		}
+		if (s13.f5 != 5+9) {
+			Console.WriteLine("   sbyte13 s13.f5: got {0} but expected {1}", s13.f5, 5+9);
+			return 5;
+		}
+		if (s13.f6 != 6+9) {
+			Console.WriteLine("   sbyte13 s13.f6: got {0} but expected {1}", s13.f6, 6+9);
+			return 6;
+		}
+		if (s13.f7 != 7+9) {
+			Console.WriteLine("   sbyte13 s13.f7: got {0} but expected {1}", s13.f7, 7+9);
+			return 7;
+		}
+		if (s13.f8 != 8+9) {
+			Console.WriteLine("   sbyte13 s13.f8: got {0} but expected {1}", s13.f8, 8+9);
+			return 8;
+		}
+		if (s13.f9 != 9+9) {
+			Console.WriteLine("   sbyte13 s13.f9: got {0} but expected {1}", s13.f9, 9+9);
+			return 9;
+		}
+		if (s13.f10 != 10+9) {
+			Console.WriteLine("   sbyte13 s13.f10: got {0} but expected {1}", s13.f10, 10+9);
+			return 10;
+		}
+		if (s13.f11 != 11+9) {
+			Console.WriteLine("   sbyte13 s13.f11: got {0} but expected {1}", s13.f11, 11+9);
+			return 11;
+		}
+		if (s13.f12 != 12+9) {
+			Console.WriteLine("   sbyte13 s13.f12: got {0} but expected {1}", s13.f12, 12+9);
+			return 12;
+		}
+		if (s13.f13 != 13+9) {
+			Console.WriteLine("   sbyte13 s13.f13: got {0} but expected {1}", s13.f13, 13+9);
+			return 13;
+		}
 
 		sbyte14 s14;
 		s14.f1 = 1;
@@ -340,11 +653,63 @@ public class Test_sbyte {
 		s14.f12 = 12;
 		s14.f13 = 13;
 		s14.f14 = 14;
-		sbyte retval14 = mono_return_sbyte14(s14, 9);
-		if (retval14 != 2*9) {
-			Console.WriteLine("   sbyte14 retval14: got {0} but expected {1}", retval14, 2*9);
+		s14 = mono_return_sbyte14(s14, 9);
+		if (s14.f1 != 1+9) {
+			Console.WriteLine("   sbyte14 s14.f1: got {0} but expected {1}", s14.f1, 1+9);
 			return 1;
 		}
+		if (s14.f2 != 2+9) {
+			Console.WriteLine("   sbyte14 s14.f2: got {0} but expected {1}", s14.f2, 2+9);
+			return 2;
+		}
+		if (s14.f3 != 3+9) {
+			Console.WriteLine("   sbyte14 s14.f3: got {0} but expected {1}", s14.f3, 3+9);
+			return 3;
+		}
+		if (s14.f4 != 4+9) {
+			Console.WriteLine("   sbyte14 s14.f4: got {0} but expected {1}", s14.f4, 4+9);
+			return 4;
+		}
+		if (s14.f5 != 5+9) {
+			Console.WriteLine("   sbyte14 s14.f5: got {0} but expected {1}", s14.f5, 5+9);
+			return 5;
+		}
+		if (s14.f6 != 6+9) {
+			Console.WriteLine("   sbyte14 s14.f6: got {0} but expected {1}", s14.f6, 6+9);
+			return 6;
+		}
+		if (s14.f7 != 7+9) {
+			Console.WriteLine("   sbyte14 s14.f7: got {0} but expected {1}", s14.f7, 7+9);
+			return 7;
+		}
+		if (s14.f8 != 8+9) {
+			Console.WriteLine("   sbyte14 s14.f8: got {0} but expected {1}", s14.f8, 8+9);
+			return 8;
+		}
+		if (s14.f9 != 9+9) {
+			Console.WriteLine("   sbyte14 s14.f9: got {0} but expected {1}", s14.f9, 9+9);
+			return 9;
+		}
+		if (s14.f10 != 10+9) {
+			Console.WriteLine("   sbyte14 s14.f10: got {0} but expected {1}", s14.f10, 10+9);
+			return 10;
+		}
+		if (s14.f11 != 11+9) {
+			Console.WriteLine("   sbyte14 s14.f11: got {0} but expected {1}", s14.f11, 11+9);
+			return 11;
+		}
+		if (s14.f12 != 12+9) {
+			Console.WriteLine("   sbyte14 s14.f12: got {0} but expected {1}", s14.f12, 12+9);
+			return 12;
+		}
+		if (s14.f13 != 13+9) {
+			Console.WriteLine("   sbyte14 s14.f13: got {0} but expected {1}", s14.f13, 13+9);
+			return 13;
+		}
+		if (s14.f14 != 14+9) {
+			Console.WriteLine("   sbyte14 s14.f14: got {0} but expected {1}", s14.f14, 14+9);
+			return 14;
+		}
 
 		sbyte15 s15;
 		s15.f1 = 1;
@@ -362,11 +727,67 @@ public class Test_sbyte {
 		s15.f13 = 13;
 		s15.f14 = 14;
 		s15.f15 = 15;
-		sbyte retval15 = mono_return_sbyte15(s15, 9);
-		if (retval15 != 2*9) {
-			Console.WriteLine("   sbyte15 retval15: got {0} but expected {1}", retval15, 2*9);
+		s15 = mono_return_sbyte15(s15, 9);
+		if (s15.f1 != 1+9) {
+			Console.WriteLine("   sbyte15 s15.f1: got {0} but expected {1}", s15.f1, 1+9);
 			return 1;
 		}
+		if (s15.f2 != 2+9) {
+			Console.WriteLine("   sbyte15 s15.f2: got {0} but expected {1}", s15.f2, 2+9);
+			return 2;
+		}
+		if (s15.f3 != 3+9) {
+			Console.WriteLine("   sbyte15 s15.f3: got {0} but expected {1}", s15.f3, 3+9);
+			return 3;
+		}
+		if (s15.f4 != 4+9) {
+			Console.WriteLine("   sbyte15 s15.f4: got {0} but expected {1}", s15.f4, 4+9);
+			return 4;
+		}
+		if (s15.f5 != 5+9) {
+			Console.WriteLine("   sbyte15 s15.f5: got {0} but expected {1}", s15.f5, 5+9);
+			return 5;
+		}
+		if (s15.f6 != 6+9) {
+			Console.WriteLine("   sbyte15 s15.f6: got {0} but expected {1}", s15.f6, 6+9);
+			return 6;
+		}
+		if (s15.f7 != 7+9) {
+			Console.WriteLine("   sbyte15 s15.f7: got {0} but expected {1}", s15.f7, 7+9);
+			return 7;
+		}
+		if (s15.f8 != 8+9) {
+			Console.WriteLine("   sbyte15 s15.f8: got {0} but expected {1}", s15.f8, 8+9);
+			return 8;
+		}
+		if (s15.f9 != 9+9) {
+			Console.WriteLine("   sbyte15 s15.f9: got {0} but expected {1}", s15.f9, 9+9);
+			return 9;
+		}
+		if (s15.f10 != 10+9) {
+			Console.WriteLine("   sbyte15 s15.f10: got {0} but expected {1}", s15.f10, 10+9);
+			return 10;
+		}
+		if (s15.f11 != 11+9) {
+			Console.WriteLine("   sbyte15 s15.f11: got {0} but expected {1}", s15.f11, 11+9);
+			return 11;
+		}
+		if (s15.f12 != 12+9) {
+			Console.WriteLine("   sbyte15 s15.f12: got {0} but expected {1}", s15.f12, 12+9);
+			return 12;
+		}
+		if (s15.f13 != 13+9) {
+			Console.WriteLine("   sbyte15 s15.f13: got {0} but expected {1}", s15.f13, 13+9);
+			return 13;
+		}
+		if (s15.f14 != 14+9) {
+			Console.WriteLine("   sbyte15 s15.f14: got {0} but expected {1}", s15.f14, 14+9);
+			return 14;
+		}
+		if (s15.f15 != 15+9) {
+			Console.WriteLine("   sbyte15 s15.f15: got {0} but expected {1}", s15.f15, 15+9);
+			return 15;
+		}
 
 		sbyte16 s16;
 		s16.f1 = 1;
@@ -385,11 +806,71 @@ public class Test_sbyte {
 		s16.f14 = 14;
 		s16.f15 = 15;
 		s16.f16 = 16;
-		sbyte retval16 = mono_return_sbyte16(s16, 9);
-		if (retval16 != 2*9) {
-			Console.WriteLine("   sbyte16 retval16: got {0} but expected {1}", retval16, 2*9);
+		s16 = mono_return_sbyte16(s16, 9);
+		if (s16.f1 != 1+9) {
+			Console.WriteLine("   sbyte16 s16.f1: got {0} but expected {1}", s16.f1, 1+9);
 			return 1;
 		}
+		if (s16.f2 != 2+9) {
+			Console.WriteLine("   sbyte16 s16.f2: got {0} but expected {1}", s16.f2, 2+9);
+			return 2;
+		}
+		if (s16.f3 != 3+9) {
+			Console.WriteLine("   sbyte16 s16.f3: got {0} but expected {1}", s16.f3, 3+9);
+			return 3;
+		}
+		if (s16.f4 != 4+9) {
+			Console.WriteLine("   sbyte16 s16.f4: got {0} but expected {1}", s16.f4, 4+9);
+			return 4;
+		}
+		if (s16.f5 != 5+9) {
+			Console.WriteLine("   sbyte16 s16.f5: got {0} but expected {1}", s16.f5, 5+9);
+			return 5;
+		}
+		if (s16.f6 != 6+9) {
+			Console.WriteLine("   sbyte16 s16.f6: got {0} but expected {1}", s16.f6, 6+9);
+			return 6;
+		}
+		if (s16.f7 != 7+9) {
+			Console.WriteLine("   sbyte16 s16.f7: got {0} but expected {1}", s16.f7, 7+9);
+			return 7;
+		}
+		if (s16.f8 != 8+9) {
+			Console.WriteLine("   sbyte16 s16.f8: got {0} but expected {1}", s16.f8, 8+9);
+			return 8;
+		}
+		if (s16.f9 != 9+9) {
+			Console.WriteLine("   sbyte16 s16.f9: got {0} but expected {1}", s16.f9, 9+9);
+			return 9;
+		}
+		if (s16.f10 != 10+9) {
+			Console.WriteLine("   sbyte16 s16.f10: got {0} but expected {1}", s16.f10, 10+9);
+			return 10;
+		}
+		if (s16.f11 != 11+9) {
+			Console.WriteLine("   sbyte16 s16.f11: got {0} but expected {1}", s16.f11, 11+9);
+			return 11;
+		}
+		if (s16.f12 != 12+9) {
+			Console.WriteLine("   sbyte16 s16.f12: got {0} but expected {1}", s16.f12, 12+9);
+			return 12;
+		}
+		if (s16.f13 != 13+9) {
+			Console.WriteLine("   sbyte16 s16.f13: got {0} but expected {1}", s16.f13, 13+9);
+			return 13;
+		}
+		if (s16.f14 != 14+9) {
+			Console.WriteLine("   sbyte16 s16.f14: got {0} but expected {1}", s16.f14, 14+9);
+			return 14;
+		}
+		if (s16.f15 != 15+9) {
+			Console.WriteLine("   sbyte16 s16.f15: got {0} but expected {1}", s16.f15, 15+9);
+			return 15;
+		}
+		if (s16.f16 != 16+9) {
+			Console.WriteLine("   sbyte16 s16.f16: got {0} but expected {1}", s16.f16, 16+9);
+			return 16;
+		}
 
 		sbyte17 s17;
 		s17.f1 = 1;
@@ -409,18 +890,161 @@ public class Test_sbyte {
 		s17.f15 = 15;
 		s17.f16 = 16;
 		s17.f17 = 17;
-		sbyte retval17 = mono_return_sbyte17(s17, 9);
-		if (retval17 != 2*9) {
-			Console.WriteLine("   sbyte17 retval17: got {0} but expected {1}", retval17, 2*9);
+		s17 = mono_return_sbyte17(s17, 9);
+		if (s17.f1 != 1+9) {
+			Console.WriteLine("   sbyte17 s17.f1: got {0} but expected {1}", s17.f1, 1+9);
 			return 1;
 		}
+		if (s17.f2 != 2+9) {
+			Console.WriteLine("   sbyte17 s17.f2: got {0} but expected {1}", s17.f2, 2+9);
+			return 2;
+		}
+		if (s17.f3 != 3+9) {
+			Console.WriteLine("   sbyte17 s17.f3: got {0} but expected {1}", s17.f3, 3+9);
+			return 3;
+		}
+		if (s17.f4 != 4+9) {
+			Console.WriteLine("   sbyte17 s17.f4: got {0} but expected {1}", s17.f4, 4+9);
+			return 4;
+		}
+		if (s17.f5 != 5+9) {
+			Console.WriteLine("   sbyte17 s17.f5: got {0} but expected {1}", s17.f5, 5+9);
+			return 5;
+		}
+		if (s17.f6 != 6+9) {
+			Console.WriteLine("   sbyte17 s17.f6: got {0} but expected {1}", s17.f6, 6+9);
+			return 6;
+		}
+		if (s17.f7 != 7+9) {
+			Console.WriteLine("   sbyte17 s17.f7: got {0} but expected {1}", s17.f7, 7+9);
+			return 7;
+		}
+		if (s17.f8 != 8+9) {
+			Console.WriteLine("   sbyte17 s17.f8: got {0} but expected {1}", s17.f8, 8+9);
+			return 8;
+		}
+		if (s17.f9 != 9+9) {
+			Console.WriteLine("   sbyte17 s17.f9: got {0} but expected {1}", s17.f9, 9+9);
+			return 9;
+		}
+		if (s17.f10 != 10+9) {
+			Console.WriteLine("   sbyte17 s17.f10: got {0} but expected {1}", s17.f10, 10+9);
+			return 10;
+		}
+		if (s17.f11 != 11+9) {
+			Console.WriteLine("   sbyte17 s17.f11: got {0} but expected {1}", s17.f11, 11+9);
+			return 11;
+		}
+		if (s17.f12 != 12+9) {
+			Console.WriteLine("   sbyte17 s17.f12: got {0} but expected {1}", s17.f12, 12+9);
+			return 12;
+		}
+		if (s17.f13 != 13+9) {
+			Console.WriteLine("   sbyte17 s17.f13: got {0} but expected {1}", s17.f13, 13+9);
+			return 13;
+		}
+		if (s17.f14 != 14+9) {
+			Console.WriteLine("   sbyte17 s17.f14: got {0} but expected {1}", s17.f14, 14+9);
+			return 14;
+		}
+		if (s17.f15 != 15+9) {
+			Console.WriteLine("   sbyte17 s17.f15: got {0} but expected {1}", s17.f15, 15+9);
+			return 15;
+		}
+		if (s17.f16 != 16+9) {
+			Console.WriteLine("   sbyte17 s17.f16: got {0} but expected {1}", s17.f16, 16+9);
+			return 16;
+		}
+		if (s17.f17 != 17+9) {
+			Console.WriteLine("   sbyte17 s17.f17: got {0} but expected {1}", s17.f17, 17+9);
+			return 17;
+		}
 
 
+		sbyte16_nested sn16;
+		sn16.nested1.f1 = 1;
+		sn16.f2 = 2;
+		sn16.f3 = 3;
+		sn16.f4 = 4;
+		sn16.f5 = 5;
+		sn16.f6 = 6;
+		sn16.f7 = 7;
+		sn16.f8 = 8;
+		sn16.f9 = 9;
+		sn16.f10 = 10;
+		sn16.f11 = 11;
+		sn16.f12 = 12;
+		sn16.f13 = 13;
+		sn16.f14 = 14;
+		sn16.f15 = 15;
+		sn16.nested2.f16 = 16;
+		sn16 = mono_return_sbyte16_nested(sn16, 9);
+		if (sn16.nested1.f1 != 1+9) {
+			Console.WriteLine("   sbyte16_nested sn16.nested1.f1: got {0} but expected {1}", sn16.nested1.f1, 1+9);
+			return 1;
+		}
+		if (sn16.f2 != 2+9) {
+			Console.WriteLine("   sbyte16_nested sn16.f2: got {0} but expected {1}", sn16.f2, 2+9);
+			return 2;
+		}
+		if (sn16.f3 != 3+9) {
+			Console.WriteLine("   sbyte16_nested sn16.f3: got {0} but expected {1}", sn16.f3, 3+9);
+			return 3;
+		}
+		if (sn16.f4 != 4+9) {
+			Console.WriteLine("   sbyte16_nested sn16.f4: got {0} but expected {1}", sn16.f4, 4+9);
+			return 4;
+		}
+		if (sn16.f5 != 5+9) {
+			Console.WriteLine("   sbyte16_nested sn16.f5: got {0} but expected {1}", sn16.f5, 5+9);
+			return 5;
+		}
+		if (sn16.f6 != 6+9) {
+			Console.WriteLine("   sbyte16_nested sn16.f6: got {0} but expected {1}", sn16.f6, 6+9);
+			return 6;
+		}
+		if (sn16.f7 != 7+9) {
+			Console.WriteLine("   sbyte16_nested sn16.f7: got {0} but expected {1}", sn16.f7, 7+9);
+			return 7;
+		}
+		if (sn16.f8 != 8+9) {
+			Console.WriteLine("   sbyte16_nested sn16.f8: got {0} but expected {1}", sn16.f8, 8+9);
+			return 8;
+		}
+		if (sn16.f9 != 9+9) {
+			Console.WriteLine("   sbyte16_nested sn16.f9: got {0} but expected {1}", sn16.f9, 9+9);
+			return 9;
+		}
+		if (sn16.f10 != 10+9) {
+			Console.WriteLine("   sbyte16_nested sn16.f10: got {0} but expected {1}", sn16.f10, 10+9);
+			return 10;
+		}
+		if (sn16.f11 != 11+9) {
+			Console.WriteLine("   sbyte16_nested sn16.f11: got {0} but expected {1}", sn16.f11, 11+9);
+			return 11;
+		}
+		if (sn16.f12 != 12+9) {
+			Console.WriteLine("   sbyte16_nested sn16.f12: got {0} but expected {1}", sn16.f12, 12+9);
+			return 12;
+		}
+		if (sn16.f13 != 13+9) {
+			Console.WriteLine("   sbyte16_nested sn16.f13: got {0} but expected {1}", sn16.f13, 13+9);
+			return 13;
+		}
+		if (sn16.f14 != 14+9) {
+			Console.WriteLine("   sbyte16_nested sn16.f14: got {0} but expected {1}", sn16.f14, 14+9);
+			return 14;
+		}
+		if (sn16.f15 != 15+9) {
+			Console.WriteLine("   sbyte16_nested sn16.f15: got {0} but expected {1}", sn16.f15, 15+9);
+			return 15;
+		}
+		if (sn16.nested2.f16 != 16+9) {
+			Console.WriteLine("   sbyte16_nested sn16.nested2.f16: got {0} but expected {1}", sn16.nested2.f16, 16+9);
+			return 16;
+		}
+
 		return 0;
 	} // end Main
 } // end class Test_sbyte
 
-
-
-
-
Index: mono-4.2.1/mono/tests/pinvoke_ppcd.cs
===================================================================
--- mono-4.2.1.orig/mono/tests/pinvoke_ppcd.cs
+++ mono-4.2.1/mono/tests/pinvoke_ppcd.cs
@@ -20,13 +20,13 @@ using System.Runtime.InteropServices;
 public class Test_double {
 
 	[DllImport ("libtest", EntryPoint="mono_return_double1")]
-	public static extern double mono_return_double1 (double1 s, int addend);
+	public static extern double1 mono_return_double1 (double1 s, int addend);
 	[StructLayout(LayoutKind.Sequential)]
 	public struct double1 {
 		public double f1;
 	}
 	[DllImport ("libtest", EntryPoint="mono_return_double2")]
-	public static extern double mono_return_double2 (double2 s, int addend);
+	public static extern double2 mono_return_double2 (double2 s, int addend);
 	[StructLayout(LayoutKind.Sequential)]
 	public struct double2 {
 		public double f1,f2;
@@ -34,37 +34,37 @@ public class Test_double {
 	// This structure is 1 element too large to use the special return
 	//  rules.
 	[DllImport ("libtest", EntryPoint="mono_return_double3")]
-	public static extern double mono_return_double3 (double3 s, int addend);
+	public static extern double3 mono_return_double3 (double3 s, int addend);
 	[StructLayout(LayoutKind.Sequential)]
 	public struct double3 {
 		public double f1,f2,f3;
 	}
 	[DllImport ("libtest", EntryPoint="mono_return_double4")]
-	public static extern double mono_return_double4 (double4 s, int addend);
+	public static extern double4 mono_return_double4 (double4 s, int addend);
 	[StructLayout(LayoutKind.Sequential)]
 	public struct double4 {
 		public double f1,f2,f3,f4;
 	}
 	[DllImport ("libtest", EntryPoint="mono_return_double5")]
-	public static extern double mono_return_double5 (double5 s, int addend);
+	public static extern double5 mono_return_double5 (double5 s, int addend);
 	[StructLayout(LayoutKind.Sequential)]
 	public struct double5 {
 		public double f1,f2,f3,f4,f5;
 	}
 	[DllImport ("libtest", EntryPoint="mono_return_double6")]
-	public static extern double mono_return_double6 (double6 s, int addend);
+	public static extern double6 mono_return_double6 (double6 s, int addend);
 	[StructLayout(LayoutKind.Sequential)]
 	public struct double6 {
 		public double f1,f2,f3,f4,f5,f6;
 	}
 	[DllImport ("libtest", EntryPoint="mono_return_double7")]
-	public static extern double mono_return_double7 (double7 s, int addend);
+	public static extern double7 mono_return_double7 (double7 s, int addend);
 	[StructLayout(LayoutKind.Sequential)]
 	public struct double7 {
 		public double f1,f2,f3,f4,f5,f6,f7;
 	}
 	[DllImport ("libtest", EntryPoint="mono_return_double8")]
-	public static extern double mono_return_double8 (double8 s, int addend);
+	public static extern double8 mono_return_double8 (double8 s, int addend);
 	[StructLayout(LayoutKind.Sequential)]
 	public struct double8 {
 		public double f1,f2,f3,f4,f5,f6,f7,f8;
@@ -72,7 +72,7 @@ public class Test_double {
 	// This structure is 1 element too large to use the special parameter
 	//  passing rules.
 	[DllImport ("libtest", EntryPoint="mono_return_double9")]
-	public static extern double mono_return_double9 (double9 s, int addend);
+	public static extern double9 mono_return_double9 (double9 s, int addend);
 	[StructLayout(LayoutKind.Sequential)]
 	public struct double9 {
 		public double f1,f2,f3,f4,f5,f6,f7,f8,f9;
@@ -94,45 +94,76 @@ public class Test_double {
 		public double2_nested2 nested2;
 	}
 
-	public static int Main (string[] args) {
+	[DllImport ("libtest", EntryPoint="mono_return_double_array4")]
+	public static extern double_array4 mono_return_double_array4 (double_array4 s, int addend);
+	[StructLayout(LayoutKind.Sequential)]
+	public unsafe struct double_array4 {
+		public fixed double f1[4];
+	}
+
 
+	public static int Main (string[] args) {
 		double1 s1;
 		s1.f1 = 1;
-		double retval1 = mono_return_double1(s1, 9);
-		if (retval1 != 2*9) {
-			Console.WriteLine("   double1 retval1: got {0} but expected {1}", retval1, 2*9);
+		s1 = mono_return_double1(s1, 9);
+		if (s1.f1 != 1+9) {
+			Console.WriteLine("   double1 s1.f1: got {0} but expected {1}", s1.f1, 1+9);
 			return 1;
 		}
 
 		double2 s2;
 		s2.f1 = 1;
 		s2.f2 = 2;
-		double retval2 = mono_return_double2(s2, 9);
-		if (retval2 != 2*9) {
-			Console.WriteLine("   double2 retval2: got {0} but expected {1}", retval2, 2*9);
+		s2 = mono_return_double2(s2, 9);
+		if (s2.f1 != 1+9) {
+			Console.WriteLine("   double2 s2.f1: got {0} but expected {1}", s2.f1, 1+9);
 			return 1;
 		}
+		if (s2.f2 != 2+9) {
+			Console.WriteLine("   double2 s2.f2: got {0} but expected {1}", s2.f2, 2+9);
+			return 2;
+		}
 
 		double3 s3;
 		s3.f1 = 1;
 		s3.f2 = 2;
 		s3.f3 = 3;
-		double retval3 = mono_return_double3(s3, 9);
-		if (retval3 != 2*9) {
-			Console.WriteLine("   double3 retval3: got {0} but expected {1}", retval3, 2*9);
+		s3 = mono_return_double3(s3, 9);
+		if (s3.f1 != 1+9) {
+			Console.WriteLine("   double3 s3.f1: got {0} but expected {1}", s3.f1, 1+9);
 			return 1;
 		}
+		if (s3.f2 != 2+9) {
+			Console.WriteLine("   double3 s3.f2: got {0} but expected {1}", s3.f2, 2+9);
+			return 2;
+		}
+		if (s3.f3 != 3+9) {
+			Console.WriteLine("   double3 s3.f3: got {0} but expected {1}", s3.f3, 3+9);
+			return 3;
+		}
 
 		double4 s4;
 		s4.f1 = 1;
 		s4.f2 = 2;
 		s4.f3 = 3;
 		s4.f4 = 4;
-		double retval4 = mono_return_double4(s4, 9);
-		if (retval4 != 2*9) {
-			Console.WriteLine("   double4 retval4: got {0} but expected {1}", retval4, 2*9);
+		s4 = mono_return_double4(s4, 9);
+		if (s4.f1 != 1+9) {
+			Console.WriteLine("   double4 s4.f1: got {0} but expected {1}", s4.f1, 1+9);
 			return 1;
 		}
+		if (s4.f2 != 2+9) {
+			Console.WriteLine("   double4 s4.f2: got {0} but expected {1}", s4.f2, 2+9);
+			return 2;
+		}
+		if (s4.f3 != 3+9) {
+			Console.WriteLine("   double4 s4.f3: got {0} but expected {1}", s4.f3, 3+9);
+			return 3;
+		}
+		if (s4.f4 != 4+9) {
+			Console.WriteLine("   double4 s4.f4: got {0} but expected {1}", s4.f4, 4+9);
+			return 4;
+		}
 
 		double5 s5;
 		s5.f1 = 1;
@@ -140,11 +171,27 @@ public class Test_double {
 		s5.f3 = 3;
 		s5.f4 = 4;
 		s5.f5 = 5;
-		double retval5 = mono_return_double5(s5, 9);
-		if (retval5 != 2*9) {
-			Console.WriteLine("   double5 retval5: got {0} but expected {1}", retval5, 2*9);
+		s5 = mono_return_double5(s5, 9);
+		if (s5.f1 != 1+9) {
+			Console.WriteLine("   double5 s5.f1: got {0} but expected {1}", s5.f1, 1+9);
 			return 1;
 		}
+		if (s5.f2 != 2+9) {
+			Console.WriteLine("   double5 s5.f2: got {0} but expected {1}", s5.f2, 2+9);
+			return 2;
+		}
+		if (s5.f3 != 3+9) {
+			Console.WriteLine("   double5 s5.f3: got {0} but expected {1}", s5.f3, 3+9);
+			return 3;
+		}
+		if (s5.f4 != 4+9) {
+			Console.WriteLine("   double5 s5.f4: got {0} but expected {1}", s5.f4, 4+9);
+			return 4;
+		}
+		if (s5.f5 != 5+9) {
+			Console.WriteLine("   double5 s5.f5: got {0} but expected {1}", s5.f5, 5+9);
+			return 5;
+		}
 
 		double6 s6;
 		s6.f1 = 1;
@@ -153,11 +200,31 @@ public class Test_double {
 		s6.f4 = 4;
 		s6.f5 = 5;
 		s6.f6 = 6;
-		double retval6 = mono_return_double6(s6, 9);
-		if (retval6 != 2*9) {
-			Console.WriteLine("   double6 retval6: got {0} but expected {1}", retval6, 2*9);
+		s6 = mono_return_double6(s6, 9);
+		if (s6.f1 != 1+9) {
+			Console.WriteLine("   double6 s6.f1: got {0} but expected {1}", s6.f1, 1+9);
 			return 1;
 		}
+		if (s6.f2 != 2+9) {
+			Console.WriteLine("   double6 s6.f2: got {0} but expected {1}", s6.f2, 2+9);
+			return 2;
+		}
+		if (s6.f3 != 3+9) {
+			Console.WriteLine("   double6 s6.f3: got {0} but expected {1}", s6.f3, 3+9);
+			return 3;
+		}
+		if (s6.f4 != 4+9) {
+			Console.WriteLine("   double6 s6.f4: got {0} but expected {1}", s6.f4, 4+9);
+			return 4;
+		}
+		if (s6.f5 != 5+9) {
+			Console.WriteLine("   double6 s6.f5: got {0} but expected {1}", s6.f5, 5+9);
+			return 5;
+		}
+		if (s6.f6 != 6+9) {
+			Console.WriteLine("   double6 s6.f6: got {0} but expected {1}", s6.f6, 6+9);
+			return 6;
+		}
 
 		double7 s7;
 		s7.f1 = 1;
@@ -167,11 +234,35 @@ public class Test_double {
 		s7.f5 = 5;
 		s7.f6 = 6;
 		s7.f7 = 7;
-		double retval7 = mono_return_double7(s7, 9);
-		if (retval7 != 2*9) {
-			Console.WriteLine("   double7 retval7: got {0} but expected {1}", retval7, 2*9);
+		s7 = mono_return_double7(s7, 9);
+		if (s7.f1 != 1+9) {
+			Console.WriteLine("   double7 s7.f1: got {0} but expected {1}", s7.f1, 1+9);
 			return 1;
 		}
+		if (s7.f2 != 2+9) {
+			Console.WriteLine("   double7 s7.f2: got {0} but expected {1}", s7.f2, 2+9);
+			return 2;
+		}
+		if (s7.f3 != 3+9) {
+			Console.WriteLine("   double7 s7.f3: got {0} but expected {1}", s7.f3, 3+9);
+			return 3;
+		}
+		if (s7.f4 != 4+9) {
+			Console.WriteLine("   double7 s7.f4: got {0} but expected {1}", s7.f4, 4+9);
+			return 4;
+		}
+		if (s7.f5 != 5+9) {
+			Console.WriteLine("   double7 s7.f5: got {0} but expected {1}", s7.f5, 5+9);
+			return 5;
+		}
+		if (s7.f6 != 6+9) {
+			Console.WriteLine("   double7 s7.f6: got {0} but expected {1}", s7.f6, 6+9);
+			return 6;
+		}
+		if (s7.f7 != 7+9) {
+			Console.WriteLine("   double7 s7.f7: got {0} but expected {1}", s7.f7, 7+9);
+			return 7;
+		}
 
 		double8 s8;
 		s8.f1 = 1;
@@ -182,11 +273,39 @@ public class Test_double {
 		s8.f6 = 6;
 		s8.f7 = 7;
 		s8.f8 = 8;
-		double retval8 = mono_return_double8(s8, 9);
-		if (retval8 != 2*9) {
-			Console.WriteLine("   double8 retval8: got {0} but expected {1}", retval8, 2*9);
+		s8 = mono_return_double8(s8, 9);
+		if (s8.f1 != 1+9) {
+			Console.WriteLine("   double8 s8.f1: got {0} but expected {1}", s8.f1, 1+9);
 			return 1;
 		}
+		if (s8.f2 != 2+9) {
+			Console.WriteLine("   double8 s8.f2: got {0} but expected {1}", s8.f2, 2+9);
+			return 2;
+		}
+		if (s8.f3 != 3+9) {
+			Console.WriteLine("   double8 s8.f3: got {0} but expected {1}", s8.f3, 3+9);
+			return 3;
+		}
+		if (s8.f4 != 4+9) {
+			Console.WriteLine("   double8 s8.f4: got {0} but expected {1}", s8.f4, 4+9);
+			return 4;
+		}
+		if (s8.f5 != 5+9) {
+			Console.WriteLine("   double8 s8.f5: got {0} but expected {1}", s8.f5, 5+9);
+			return 5;
+		}
+		if (s8.f6 != 6+9) {
+			Console.WriteLine("   double8 s8.f6: got {0} but expected {1}", s8.f6, 6+9);
+			return 6;
+		}
+		if (s8.f7 != 7+9) {
+			Console.WriteLine("   double8 s8.f7: got {0} but expected {1}", s8.f7, 7+9);
+			return 7;
+		}
+		if (s8.f8 != 8+9) {
+			Console.WriteLine("   double8 s8.f8: got {0} but expected {1}", s8.f8, 8+9);
+			return 8;
+		}
 
 		double9 s9;
 		s9.f1 = 1;
@@ -198,18 +317,86 @@ public class Test_double {
 		s9.f7 = 7;
 		s9.f8 = 8;
 		s9.f9 = 9;
-		double retval9 = mono_return_double9(s9, 9);
-		if (retval9 != 2*9) {
-			Console.WriteLine("   double9 retval9: got {0} but expected {1}", retval9, 2*9);
+		s9 = mono_return_double9(s9, 9);
+		if (s9.f1 != 1+9) {
+			Console.WriteLine("   double9 s9.f1: got {0} but expected {1}", s9.f1, 1+9);
+			return 1;
+		}
+		if (s9.f2 != 2+9) {
+			Console.WriteLine("   double9 s9.f2: got {0} but expected {1}", s9.f2, 2+9);
+			return 2;
+		}
+		if (s9.f3 != 3+9) {
+			Console.WriteLine("   double9 s9.f3: got {0} but expected {1}", s9.f3, 3+9);
+			return 3;
+		}
+		if (s9.f4 != 4+9) {
+			Console.WriteLine("   double9 s9.f4: got {0} but expected {1}", s9.f4, 4+9);
+			return 4;
+		}
+		if (s9.f5 != 5+9) {
+			Console.WriteLine("   double9 s9.f5: got {0} but expected {1}", s9.f5, 5+9);
+			return 5;
+		}
+		if (s9.f6 != 6+9) {
+			Console.WriteLine("   double9 s9.f6: got {0} but expected {1}", s9.f6, 6+9);
+			return 6;
+		}
+		if (s9.f7 != 7+9) {
+			Console.WriteLine("   double9 s9.f7: got {0} but expected {1}", s9.f7, 7+9);
+			return 7;
+		}
+		if (s9.f8 != 8+9) {
+			Console.WriteLine("   double9 s9.f8: got {0} but expected {1}", s9.f8, 8+9);
+			return 8;
+		}
+		if (s9.f9 != 9+9) {
+			Console.WriteLine("   double9 s9.f9: got {0} but expected {1}", s9.f9, 9+9);
+			return 9;
+		}
+
+
+		double2_nested sn2;
+		sn2.nested1.f1 = 1;
+		sn2.nested2.f2 = 2;
+		sn2 = mono_return_double2_nested(sn2, 9);
+		if (sn2.nested1.f1 != 1+9) {
+			Console.WriteLine("   double2_nested sn2.nested1.f1: got {0} but expected {1}", sn2.nested1.f1, 1+9);
 			return 1;
 		}
+		if (sn2.nested2.f2 != 2+9) {
+			Console.WriteLine("   double2_nested sn2.nested2.f2: got {0} but expected {1}", sn2.nested2.f2, 2+9);
+			return 2;
+		}
 
+/*
+//  NOTE: this test does not work properly because mini_type_is_hfa in mini-codegen.c does not handle arrays.
+//        Uncomment this when mini_type_is_hfa is fixed.
+		unsafe {
+		double_array4 sa4;
+		sa4.f1[0] = 1;
+		sa4.f1[1] = 2;
+		sa4 = mono_return_double_array4(sa4, 9);
+		if (sa4.f1[0] != 1+9) {
+			Console.WriteLine("   double_array4 sa4.f1[0]: got {0} but expected {1}", sa4.f1[0], 1+9);
+			return 1;
+		}
+		if (sa4.f1[1] != 2+9) {
+			Console.WriteLine("   double_array4 sa4.f1[1]: got {0} but expected {1}", sa4.f1[1], 2+9);
+			return 2;
+		}
+		if (sa4.f1[2] != 3+9) {
+			Console.WriteLine("   double_array4 sa4.f1[2]: got {0} but expected {1}", sa4.f1[2], 3+9);
+			return 3;
+		}
+		if (sa4.f1[3] != 4+9) {
+			Console.WriteLine("   double_array4 sa4.f1[3]: got {0} but expected {1}", sa4.f1[3], 4+9);
+			return 4;
+		}
+		}
+*/
 
 		return 0;
 	} // end Main
 } // end class Test_double
 
-
-
-
-
Index: mono-4.2.1/mono/tests/pinvoke_ppcf.cs
===================================================================
--- mono-4.2.1.orig/mono/tests/pinvoke_ppcf.cs
+++ mono-4.2.1/mono/tests/pinvoke_ppcf.cs
@@ -20,25 +20,25 @@ using System.Runtime.InteropServices;
 public class Test_float {
 
 	[DllImport ("libtest", EntryPoint="mono_return_float1")]
-	public static extern float mono_return_float1 (float1 s, int addend);
+	public static extern float1 mono_return_float1 (float1 s, int addend);
 	[StructLayout(LayoutKind.Sequential)]
 	public struct float1 {
 		public float f1;
 	}
 	[DllImport ("libtest", EntryPoint="mono_return_float2")]
-	public static extern float mono_return_float2 (float2 s, int addend);
+	public static extern float2 mono_return_float2 (float2 s, int addend);
 	[StructLayout(LayoutKind.Sequential)]
 	public struct float2 {
 		public float f1,f2;
 	}
 	[DllImport ("libtest", EntryPoint="mono_return_float3")]
-	public static extern float mono_return_float3 (float3 s, int addend);
+	public static extern float3 mono_return_float3 (float3 s, int addend);
 	[StructLayout(LayoutKind.Sequential)]
 	public struct float3 {
 		public float f1,f2,f3;
 	}
 	[DllImport ("libtest", EntryPoint="mono_return_float4")]
-	public static extern float mono_return_float4 (float4 s, int addend);
+	public static extern float4 mono_return_float4 (float4 s, int addend);
 	[StructLayout(LayoutKind.Sequential)]
 	public struct float4 {
 		public float f1,f2,f3,f4;
@@ -46,25 +46,25 @@ public class Test_float {
 	// This structure is 1 element too large to use the special return
 	//  rules.
 	[DllImport ("libtest", EntryPoint="mono_return_float5")]
-	public static extern float mono_return_float5 (float5 s, int addend);
+	public static extern float5 mono_return_float5 (float5 s, int addend);
 	[StructLayout(LayoutKind.Sequential)]
 	public struct float5 {
 		public float f1,f2,f3,f4,f5;
 	}
 	[DllImport ("libtest", EntryPoint="mono_return_float6")]
-	public static extern float mono_return_float6 (float6 s, int addend);
+	public static extern float6 mono_return_float6 (float6 s, int addend);
 	[StructLayout(LayoutKind.Sequential)]
 	public struct float6 {
 		public float f1,f2,f3,f4,f5,f6;
 	}
 	[DllImport ("libtest", EntryPoint="mono_return_float7")]
-	public static extern float mono_return_float7 (float7 s, int addend);
+	public static extern float7 mono_return_float7 (float7 s, int addend);
 	[StructLayout(LayoutKind.Sequential)]
 	public struct float7 {
 		public float f1,f2,f3,f4,f5,f6,f7;
 	}
 	[DllImport ("libtest", EntryPoint="mono_return_float8")]
-	public static extern float mono_return_float8 (float8 s, int addend);
+	public static extern float8 mono_return_float8 (float8 s, int addend);
 	[StructLayout(LayoutKind.Sequential)]
 	public struct float8 {
 		public float f1,f2,f3,f4,f5,f6,f7,f8;
@@ -72,7 +72,7 @@ public class Test_float {
 	// This structure is 1 element too large to use the special parameter
 	//  passing rules.
 	[DllImport ("libtest", EntryPoint="mono_return_float9")]
-	public static extern float mono_return_float9 (float9 s, int addend);
+	public static extern float9 mono_return_float9 (float9 s, int addend);
 	[StructLayout(LayoutKind.Sequential)]
 	public struct float9 {
 		public float f1,f2,f3,f4,f5,f6,f7,f8,f9;
@@ -99,41 +99,65 @@ public class Test_float {
 
 		float1 s1;
 		s1.f1 = 1;
-		float retval1 = mono_return_float1(s1, 906);
-		if (retval1 != 2*906) {
-			Console.WriteLine("   float1 retval1: got {0} but expected {1}", retval1, 2*906);
+		s1 = mono_return_float1(s1, 906);
+		if (s1.f1 != 1+906) {
+			Console.WriteLine("   float1 s1.f1: got {0} but expected {1}", s1.f1, 1+906);
 			return 1;
 		}
 
 		float2 s2;
 		s2.f1 = 1;
 		s2.f2 = 2;
-		float retval2 = mono_return_float2(s2, 906);
-		if (retval2 != 2*906) {
-			Console.WriteLine("   float2 retval2: got {0} but expected {1}", retval2, 2*906);
+		s2 = mono_return_float2(s2, 906);
+		if (s2.f1 != 1+906) {
+			Console.WriteLine("   float2 s2.f1: got {0} but expected {1}", s2.f1, 1+906);
 			return 1;
 		}
+		if (s2.f2 != 2+906) {
+			Console.WriteLine("   float2 s2.f2: got {0} but expected {1}", s2.f2, 2+906);
+			return 2;
+		}
 
 		float3 s3;
 		s3.f1 = 1;
 		s3.f2 = 2;
 		s3.f3 = 3;
-		float retval3 = mono_return_float3(s3, 906);
-		if (retval3 != 2*906) {
-			Console.WriteLine("   float3 retval3: got {0} but expected {1}", retval3, 2*906);
+		s3 = mono_return_float3(s3, 906);
+		if (s3.f1 != 1+906) {
+			Console.WriteLine("   float3 s3.f1: got {0} but expected {1}", s3.f1, 1+906);
 			return 1;
 		}
+		if (s3.f2 != 2+906) {
+			Console.WriteLine("   float3 s3.f2: got {0} but expected {1}", s3.f2, 2+906);
+			return 2;
+		}
+		if (s3.f3 != 3+906) {
+			Console.WriteLine("   float3 s3.f3: got {0} but expected {1}", s3.f3, 3+906);
+			return 3;
+		}
 
 		float4 s4;
 		s4.f1 = 1;
 		s4.f2 = 2;
 		s4.f3 = 3;
 		s4.f4 = 4;
-		float retval4 = mono_return_float4(s4, 906);
-		if (retval4 != 2*906) {
-			Console.WriteLine("   float4 retval4: got {0} but expected {1}", retval4, 2*906);
+		s4 = mono_return_float4(s4, 906);
+		if (s4.f1 != 1+906) {
+			Console.WriteLine("   float4 s4.f1: got {0} but expected {1}", s4.f1, 1+906);
 			return 1;
 		}
+		if (s4.f2 != 2+906) {
+			Console.WriteLine("   float4 s4.f2: got {0} but expected {1}", s4.f2, 2+906);
+			return 2;
+		}
+		if (s4.f3 != 3+906) {
+			Console.WriteLine("   float4 s4.f3: got {0} but expected {1}", s4.f3, 3+906);
+			return 3;
+		}
+		if (s4.f4 != 4+906) {
+			Console.WriteLine("   float4 s4.f4: got {0} but expected {1}", s4.f4, 4+906);
+			return 4;
+		}
 
 		float5 s5;
 		s5.f1 = 1;
@@ -141,11 +165,27 @@ public class Test_float {
 		s5.f3 = 3;
 		s5.f4 = 4;
 		s5.f5 = 5;
-		float retval5 = mono_return_float5(s5, 906);
-		if (retval5 != 2*906) {
-			Console.WriteLine("   float5 retval5: got {0} but expected {1}", retval5, 2*906);
+		s5 = mono_return_float5(s5, 906);
+		if (s5.f1 != 1+906) {
+			Console.WriteLine("   float5 s5.f1: got {0} but expected {1}", s5.f1, 1+906);
 			return 1;
 		}
+		if (s5.f2 != 2+906) {
+			Console.WriteLine("   float5 s5.f2: got {0} but expected {1}", s5.f2, 2+906);
+			return 2;
+		}
+		if (s5.f3 != 3+906) {
+			Console.WriteLine("   float5 s5.f3: got {0} but expected {1}", s5.f3, 3+906);
+			return 3;
+		}
+		if (s5.f4 != 4+906) {
+			Console.WriteLine("   float5 s5.f4: got {0} but expected {1}", s5.f4, 4+906);
+			return 4;
+		}
+		if (s5.f5 != 5+906) {
+			Console.WriteLine("   float5 s5.f5: got {0} but expected {1}", s5.f5, 5+906);
+			return 5;
+		}
 
 		float6 s6;
 		s6.f1 = 1;
@@ -154,11 +194,31 @@ public class Test_float {
 		s6.f4 = 4;
 		s6.f5 = 5;
 		s6.f6 = 6;
-		float retval6 = mono_return_float6(s6, 906);
-		if (retval6 != 2*906) {
-			Console.WriteLine("   float6 retval6: got {0} but expected {1}", retval6, 2*906);
+		s6 = mono_return_float6(s6, 906);
+		if (s6.f1 != 1+906) {
+			Console.WriteLine("   float6 s6.f1: got {0} but expected {1}", s6.f1, 1+906);
 			return 1;
 		}
+		if (s6.f2 != 2+906) {
+			Console.WriteLine("   float6 s6.f2: got {0} but expected {1}", s6.f2, 2+906);
+			return 2;
+		}
+		if (s6.f3 != 3+906) {
+			Console.WriteLine("   float6 s6.f3: got {0} but expected {1}", s6.f3, 3+906);
+			return 3;
+		}
+		if (s6.f4 != 4+906) {
+			Console.WriteLine("   float6 s6.f4: got {0} but expected {1}", s6.f4, 4+906);
+			return 4;
+		}
+		if (s6.f5 != 5+906) {
+			Console.WriteLine("   float6 s6.f5: got {0} but expected {1}", s6.f5, 5+906);
+			return 5;
+		}
+		if (s6.f6 != 6+906) {
+			Console.WriteLine("   float6 s6.f6: got {0} but expected {1}", s6.f6, 6+906);
+			return 6;
+		}
 
 		float7 s7;
 		s7.f1 = 1;
@@ -168,11 +228,35 @@ public class Test_float {
 		s7.f5 = 5;
 		s7.f6 = 6;
 		s7.f7 = 7;
-		float retval7 = mono_return_float7(s7, 906);
-		if (retval7 != 2*906) {
-			Console.WriteLine("   float7 retval7: got {0} but expected {1}", retval7, 2*906);
+		s7 = mono_return_float7(s7, 906);
+		if (s7.f1 != 1+906) {
+			Console.WriteLine("   float7 s7.f1: got {0} but expected {1}", s7.f1, 1+906);
 			return 1;
 		}
+		if (s7.f2 != 2+906) {
+			Console.WriteLine("   float7 s7.f2: got {0} but expected {1}", s7.f2, 2+906);
+			return 2;
+		}
+		if (s7.f3 != 3+906) {
+			Console.WriteLine("   float7 s7.f3: got {0} but expected {1}", s7.f3, 3+906);
+			return 3;
+		}
+		if (s7.f4 != 4+906) {
+			Console.WriteLine("   float7 s7.f4: got {0} but expected {1}", s7.f4, 4+906);
+			return 4;
+		}
+		if (s7.f5 != 5+906) {
+			Console.WriteLine("   float7 s7.f5: got {0} but expected {1}", s7.f5, 5+906);
+			return 5;
+		}
+		if (s7.f6 != 6+906) {
+			Console.WriteLine("   float7 s7.f6: got {0} but expected {1}", s7.f6, 6+906);
+			return 6;
+		}
+		if (s7.f7 != 7+906) {
+			Console.WriteLine("   float7 s7.f7: got {0} but expected {1}", s7.f7, 7+906);
+			return 7;
+		}
 
 		float8 s8;
 		s8.f1 = 1;
@@ -183,11 +267,39 @@ public class Test_float {
 		s8.f6 = 6;
 		s8.f7 = 7;
 		s8.f8 = 8;
-		float retval8 = mono_return_float8(s8, 906);
-		if (retval8 != 2*906) {
-			Console.WriteLine("   float8 retval8: got {0} but expected {1}", retval8, 2*906);
+		s8 = mono_return_float8(s8, 906);
+		if (s8.f1 != 1+906) {
+			Console.WriteLine("   float8 s8.f1: got {0} but expected {1}", s8.f1, 1+906);
 			return 1;
 		}
+		if (s8.f2 != 2+906) {
+			Console.WriteLine("   float8 s8.f2: got {0} but expected {1}", s8.f2, 2+906);
+			return 2;
+		}
+		if (s8.f3 != 3+906) {
+			Console.WriteLine("   float8 s8.f3: got {0} but expected {1}", s8.f3, 3+906);
+			return 3;
+		}
+		if (s8.f4 != 4+906) {
+			Console.WriteLine("   float8 s8.f4: got {0} but expected {1}", s8.f4, 4+906);
+			return 4;
+		}
+		if (s8.f5 != 5+906) {
+			Console.WriteLine("   float8 s8.f5: got {0} but expected {1}", s8.f5, 5+906);
+			return 5;
+		}
+		if (s8.f6 != 6+906) {
+			Console.WriteLine("   float8 s8.f6: got {0} but expected {1}", s8.f6, 6+906);
+			return 6;
+		}
+		if (s8.f7 != 7+906) {
+			Console.WriteLine("   float8 s8.f7: got {0} but expected {1}", s8.f7, 7+906);
+			return 7;
+		}
+		if (s8.f8 != 8+906) {
+			Console.WriteLine("   float8 s8.f8: got {0} but expected {1}", s8.f8, 8+906);
+			return 8;
+		}
 
 		float9 s9;
 		s9.f1 = 1;
@@ -199,18 +311,69 @@ public class Test_float {
 		s9.f7 = 7;
 		s9.f8 = 8;
 		s9.f9 = 9;
-		float retval9 = mono_return_float9(s9, 906);
-		if (retval9 != 2*906) {
-			Console.WriteLine("   float9 retval9: got {0} but expected {1}", retval9, 2*906);
+		s9 = mono_return_float9(s9, 906);
+		if (s9.f1 != 1+906) {
+			Console.WriteLine("   float9 s9.f1: got {0} but expected {1}", s9.f1, 1+906);
 			return 1;
 		}
+		if (s9.f2 != 2+906) {
+			Console.WriteLine("   float9 s9.f2: got {0} but expected {1}", s9.f2, 2+906);
+			return 2;
+		}
+		if (s9.f3 != 3+906) {
+			Console.WriteLine("   float9 s9.f3: got {0} but expected {1}", s9.f3, 3+906);
+			return 3;
+		}
+		if (s9.f4 != 4+906) {
+			Console.WriteLine("   float9 s9.f4: got {0} but expected {1}", s9.f4, 4+906);
+			return 4;
+		}
+		if (s9.f5 != 5+906) {
+			Console.WriteLine("   float9 s9.f5: got {0} but expected {1}", s9.f5, 5+906);
+			return 5;
+		}
+		if (s9.f6 != 6+906) {
+			Console.WriteLine("   float9 s9.f6: got {0} but expected {1}", s9.f6, 6+906);
+			return 6;
+		}
+		if (s9.f7 != 7+906) {
+			Console.WriteLine("   float9 s9.f7: got {0} but expected {1}", s9.f7, 7+906);
+			return 7;
+		}
+		if (s9.f8 != 8+906) {
+			Console.WriteLine("   float9 s9.f8: got {0} but expected {1}", s9.f8, 8+906);
+			return 8;
+		}
+		if (s9.f9 != 9+906) {
+			Console.WriteLine("   float9 s9.f9: got {0} but expected {1}", s9.f9, 9+906);
+			return 9;
+		}
 
 
+		float4_nested sn4;
+		sn4.nested1.f1 = 1;
+		sn4.f2 = 2;
+		sn4.f3 = 3;
+		sn4.nested2.f4 = 4;
+		sn4 = mono_return_float4_nested(sn4, 906);
+		if (sn4.nested1.f1 != 1+906) {
+			Console.WriteLine("   float4_nested sn4.nested1.f1: got {0} but expected {1}", sn4.nested1.f1, 1+906);
+			return 1;
+		}
+		if (sn4.f2 != 2+906) {
+			Console.WriteLine("   float4_nested sn4.f2: got {0} but expected {1}", sn4.f2, 2+906);
+			return 2;
+		}
+		if (sn4.f3 != 3+906) {
+			Console.WriteLine("   float4_nested sn4.f3: got {0} but expected {1}", sn4.f3, 3+906);
+			return 3;
+		}
+		if (sn4.nested2.f4 != 4+906) {
+			Console.WriteLine("   float4_nested sn4.nested2.f4: got {0} but expected {1}", sn4.nested2.f4, 4+906);
+			return 4;
+		}
+
 		return 0;
 	} // end Main
 } // end class Test_float
 
-
-
-
-
Index: mono-4.2.1/mono/tests/pinvoke_ppci.cs
===================================================================
--- mono-4.2.1.orig/mono/tests/pinvoke_ppci.cs
+++ mono-4.2.1/mono/tests/pinvoke_ppci.cs
@@ -20,25 +20,25 @@ using System.Runtime.InteropServices;
 public class Test_int {
 
 	[DllImport ("libtest", EntryPoint="mono_return_int1")]
-	public static extern int mono_return_int1 (int1 s, int addend);
+	public static extern int1 mono_return_int1 (int1 s, int addend);
 	[StructLayout(LayoutKind.Sequential)]
 	public struct int1 {
 		public int f1;
 	}
 	[DllImport ("libtest", EntryPoint="mono_return_int2")]
-	public static extern int mono_return_int2 (int2 s, int addend);
+	public static extern int2 mono_return_int2 (int2 s, int addend);
 	[StructLayout(LayoutKind.Sequential)]
 	public struct int2 {
 		public int f1,f2;
 	}
 	[DllImport ("libtest", EntryPoint="mono_return_int3")]
-	public static extern int mono_return_int3 (int3 s, int addend);
+	public static extern int3 mono_return_int3 (int3 s, int addend);
 	[StructLayout(LayoutKind.Sequential)]
 	public struct int3 {
 		public int f1,f2,f3;
 	}
 	[DllImport ("libtest", EntryPoint="mono_return_int4")]
-	public static extern int mono_return_int4 (int4 s, int addend);
+	public static extern int4 mono_return_int4 (int4 s, int addend);
 	[StructLayout(LayoutKind.Sequential)]
 	public struct int4 {
 		public int f1,f2,f3,f4;
@@ -46,7 +46,7 @@ public class Test_int {
 	// This structure is 1 element too large to use the special return
 	//  rules.
 	[DllImport ("libtest", EntryPoint="mono_return_int5")]
-	public static extern int mono_return_int5 (int5 s, int addend);
+	public static extern int5 mono_return_int5 (int5 s, int addend);
 	[StructLayout(LayoutKind.Sequential)]
 	public struct int5 {
 		public int f1,f2,f3,f4,f5;
@@ -73,41 +73,65 @@ public class Test_int {
 
 		int1 s1;
 		s1.f1 = 1;
-		int retval1 = mono_return_int1(s1, 906);
-		if (retval1 != 2*906) {
-			Console.WriteLine("   int1 retval1: got {0} but expected {1}", retval1, 2*906);
+		s1 = mono_return_int1(s1, 906);
+		if (s1.f1 != 1+906) {
+			Console.WriteLine("   int1 s1.f1: got {0} but expected {1}", s1.f1, 1+906);
 			return 1;
 		}
 
 		int2 s2;
 		s2.f1 = 1;
 		s2.f2 = 2;
-		int retval2 = mono_return_int2(s2, 906);
-		if (retval2 != 2*906) {
-			Console.WriteLine("   int2 retval2: got {0} but expected {1}", retval2, 2*906);
+		s2 = mono_return_int2(s2, 906);
+		if (s2.f1 != 1+906) {
+			Console.WriteLine("   int2 s2.f1: got {0} but expected {1}", s2.f1, 1+906);
 			return 1;
 		}
+		if (s2.f2 != 2+906) {
+			Console.WriteLine("   int2 s2.f2: got {0} but expected {1}", s2.f2, 2+906);
+			return 2;
+		}
 
 		int3 s3;
 		s3.f1 = 1;
 		s3.f2 = 2;
 		s3.f3 = 3;
-		int retval3 = mono_return_int3(s3, 906);
-		if (retval3 != 2*906) {
-			Console.WriteLine("   int3 retval3: got {0} but expected {1}", retval3, 2*906);
+		s3 = mono_return_int3(s3, 906);
+		if (s3.f1 != 1+906) {
+			Console.WriteLine("   int3 s3.f1: got {0} but expected {1}", s3.f1, 1+906);
 			return 1;
 		}
+		if (s3.f2 != 2+906) {
+			Console.WriteLine("   int3 s3.f2: got {0} but expected {1}", s3.f2, 2+906);
+			return 2;
+		}
+		if (s3.f3 != 3+906) {
+			Console.WriteLine("   int3 s3.f3: got {0} but expected {1}", s3.f3, 3+906);
+			return 3;
+		}
 
 		int4 s4;
 		s4.f1 = 1;
 		s4.f2 = 2;
 		s4.f3 = 3;
 		s4.f4 = 4;
-		int retval4 = mono_return_int4(s4, 906);
-		if (retval4 != 2*906) {
-			Console.WriteLine("   int4 retval4: got {0} but expected {1}", retval4, 2*906);
+		s4 = mono_return_int4(s4, 906);
+		if (s4.f1 != 1+906) {
+			Console.WriteLine("   int4 s4.f1: got {0} but expected {1}", s4.f1, 1+906);
 			return 1;
 		}
+		if (s4.f2 != 2+906) {
+			Console.WriteLine("   int4 s4.f2: got {0} but expected {1}", s4.f2, 2+906);
+			return 2;
+		}
+		if (s4.f3 != 3+906) {
+			Console.WriteLine("   int4 s4.f3: got {0} but expected {1}", s4.f3, 3+906);
+			return 3;
+		}
+		if (s4.f4 != 4+906) {
+			Console.WriteLine("   int4 s4.f4: got {0} but expected {1}", s4.f4, 4+906);
+			return 4;
+		}
 
 		int5 s5;
 		s5.f1 = 1;
@@ -115,18 +139,53 @@ public class Test_int {
 		s5.f3 = 3;
 		s5.f4 = 4;
 		s5.f5 = 5;
-		int retval5 = mono_return_int5(s5, 906);
-		if (retval5 != 2*906) {
-			Console.WriteLine("   int5 retval5: got {0} but expected {1}", retval5, 2*906);
+		s5 = mono_return_int5(s5, 906);
+		if (s5.f1 != 1+906) {
+			Console.WriteLine("   int5 s5.f1: got {0} but expected {1}", s5.f1, 1+906);
 			return 1;
 		}
+		if (s5.f2 != 2+906) {
+			Console.WriteLine("   int5 s5.f2: got {0} but expected {1}", s5.f2, 2+906);
+			return 2;
+		}
+		if (s5.f3 != 3+906) {
+			Console.WriteLine("   int5 s5.f3: got {0} but expected {1}", s5.f3, 3+906);
+			return 3;
+		}
+		if (s5.f4 != 4+906) {
+			Console.WriteLine("   int5 s5.f4: got {0} but expected {1}", s5.f4, 4+906);
+			return 4;
+		}
+		if (s5.f5 != 5+906) {
+			Console.WriteLine("   int5 s5.f5: got {0} but expected {1}", s5.f5, 5+906);
+			return 5;
+		}
 
 
+		int4_nested sn4;
+		sn4.nested1.f1 = 1;
+		sn4.f2 = 2;
+		sn4.f3 = 3;
+		sn4.nested2.f4 = 4;
+		sn4 = mono_return_int4_nested(sn4, 906);
+		if (sn4.nested1.f1 != 1+906) {
+			Console.WriteLine("   int4_nested sn4.nested1.f1: got {0} but expected {1}", sn4.nested1.f1, 1+906);
+			return 1;
+		}
+		if (sn4.f2 != 2+906) {
+			Console.WriteLine("   int4_nested sn4.f2: got {0} but expected {1}", sn4.f2, 2+906);
+			return 2;
+		}
+		if (sn4.f3 != 3+906) {
+			Console.WriteLine("   int4_nested sn4.f3: got {0} but expected {1}", sn4.f3, 3+906);
+			return 3;
+		}
+		if (sn4.nested2.f4 != 4+906) {
+			Console.WriteLine("   int4_nested sn4.nested2.f4: got {0} but expected {1}", sn4.nested2.f4, 4+906);
+			return 4;
+		}
+
 		return 0;
 	} // end Main
 } // end class Test_int
 
-
-
-
-
Index: mono-4.2.1/mono/tests/pinvoke_ppcs.cs
===================================================================
--- mono-4.2.1.orig/mono/tests/pinvoke_ppcs.cs
+++ mono-4.2.1/mono/tests/pinvoke_ppcs.cs
@@ -20,49 +20,49 @@ using System.Runtime.InteropServices;
 public class Test_short {
 
 	[DllImport ("libtest", EntryPoint="mono_return_short1")]
-	public static extern short mono_return_short1 (short1 s, int addend);
+	public static extern short1 mono_return_short1 (short1 s, int addend);
 	[StructLayout(LayoutKind.Sequential)]
 	public struct short1 {
 		public short f1;
 	}
 	[DllImport ("libtest", EntryPoint="mono_return_short2")]
-	public static extern short mono_return_short2 (short2 s, int addend);
+	public static extern short2 mono_return_short2 (short2 s, int addend);
 	[StructLayout(LayoutKind.Sequential)]
 	public struct short2 {
 		public short f1,f2;
 	}
 	[DllImport ("libtest", EntryPoint="mono_return_short3")]
-	public static extern short mono_return_short3 (short3 s, int addend);
+	public static extern short3 mono_return_short3 (short3 s, int addend);
 	[StructLayout(LayoutKind.Sequential)]
 	public struct short3 {
 		public short f1,f2,f3;
 	}
 	[DllImport ("libtest", EntryPoint="mono_return_short4")]
-	public static extern short mono_return_short4 (short4 s, int addend);
+	public static extern short4 mono_return_short4 (short4 s, int addend);
 	[StructLayout(LayoutKind.Sequential)]
 	public struct short4 {
 		public short f1,f2,f3,f4;
 	}
 	[DllImport ("libtest", EntryPoint="mono_return_short5")]
-	public static extern short mono_return_short5 (short5 s, int addend);
+	public static extern short5 mono_return_short5 (short5 s, int addend);
 	[StructLayout(LayoutKind.Sequential)]
 	public struct short5 {
 		public short f1,f2,f3,f4,f5;
 	}
 	[DllImport ("libtest", EntryPoint="mono_return_short6")]
-	public static extern short mono_return_short6 (short6 s, int addend);
+	public static extern short6 mono_return_short6 (short6 s, int addend);
 	[StructLayout(LayoutKind.Sequential)]
 	public struct short6 {
 		public short f1,f2,f3,f4,f5,f6;
 	}
 	[DllImport ("libtest", EntryPoint="mono_return_short7")]
-	public static extern short mono_return_short7 (short7 s, int addend);
+	public static extern short7 mono_return_short7 (short7 s, int addend);
 	[StructLayout(LayoutKind.Sequential)]
 	public struct short7 {
 		public short f1,f2,f3,f4,f5,f6,f7;
 	}
 	[DllImport ("libtest", EntryPoint="mono_return_short8")]
-	public static extern short mono_return_short8 (short8 s, int addend);
+	public static extern short8 mono_return_short8 (short8 s, int addend);
 	[StructLayout(LayoutKind.Sequential)]
 	public struct short8 {
 		public short f1,f2,f3,f4,f5,f6,f7,f8;
@@ -70,7 +70,7 @@ public class Test_short {
 	// This structure is 1 element too large to use the special return
 	//  rules.
 	[DllImport ("libtest", EntryPoint="mono_return_short9")]
-	public static extern short mono_return_short9 (short9 s, int addend);
+	public static extern short9 mono_return_short9 (short9 s, int addend);
 	[StructLayout(LayoutKind.Sequential)]
 	public struct short9 {
 		public short f1,f2,f3,f4,f5,f6,f7,f8,f9;
@@ -97,41 +97,65 @@ public class Test_short {
 
 		short1 s1;
 		s1.f1 = 1;
-		short retval1 = mono_return_short1(s1, 90);
-		if (retval1 != 2*90) {
-			Console.WriteLine("   short1 retval1: got {0} but expected {1}", retval1, 2*90);
+		s1 = mono_return_short1(s1, 90);
+		if (s1.f1 != 1+90) {
+			Console.WriteLine("   short1 s1.f1: got {0} but expected {1}", s1.f1, 1+90);
 			return 1;
 		}
 
 		short2 s2;
 		s2.f1 = 1;
 		s2.f2 = 2;
-		short retval2 = mono_return_short2(s2, 90);
-		if (retval2 != 2*90) {
-			Console.WriteLine("   short2 retval2: got {0} but expected {1}", retval2, 2*90);
+		s2 = mono_return_short2(s2, 90);
+		if (s2.f1 != 1+90) {
+			Console.WriteLine("   short2 s2.f1: got {0} but expected {1}", s2.f1, 1+90);
 			return 1;
 		}
+		if (s2.f2 != 2+90) {
+			Console.WriteLine("   short2 s2.f2: got {0} but expected {1}", s2.f2, 2+90);
+			return 2;
+		}
 
 		short3 s3;
 		s3.f1 = 1;
 		s3.f2 = 2;
 		s3.f3 = 3;
-		short retval3 = mono_return_short3(s3, 90);
-		if (retval3 != 2*90) {
-			Console.WriteLine("   short3 retval3: got {0} but expected {1}", retval3, 2*90);
+		s3 = mono_return_short3(s3, 90);
+		if (s3.f1 != 1+90) {
+			Console.WriteLine("   short3 s3.f1: got {0} but expected {1}", s3.f1, 1+90);
 			return 1;
 		}
+		if (s3.f2 != 2+90) {
+			Console.WriteLine("   short3 s3.f2: got {0} but expected {1}", s3.f2, 2+90);
+			return 2;
+		}
+		if (s3.f3 != 3+90) {
+			Console.WriteLine("   short3 s3.f3: got {0} but expected {1}", s3.f3, 3+90);
+			return 3;
+		}
 
 		short4 s4;
 		s4.f1 = 1;
 		s4.f2 = 2;
 		s4.f3 = 3;
 		s4.f4 = 4;
-		short retval4 = mono_return_short4(s4, 90);
-		if (retval4 != 2*90) {
-			Console.WriteLine("   short4 retval4: got {0} but expected {1}", retval4, 2*90);
+		s4 = mono_return_short4(s4, 90);
+		if (s4.f1 != 1+90) {
+			Console.WriteLine("   short4 s4.f1: got {0} but expected {1}", s4.f1, 1+90);
 			return 1;
 		}
+		if (s4.f2 != 2+90) {
+			Console.WriteLine("   short4 s4.f2: got {0} but expected {1}", s4.f2, 2+90);
+			return 2;
+		}
+		if (s4.f3 != 3+90) {
+			Console.WriteLine("   short4 s4.f3: got {0} but expected {1}", s4.f3, 3+90);
+			return 3;
+		}
+		if (s4.f4 != 4+90) {
+			Console.WriteLine("   short4 s4.f4: got {0} but expected {1}", s4.f4, 4+90);
+			return 4;
+		}
 
 		short5 s5;
 		s5.f1 = 1;
@@ -139,11 +163,27 @@ public class Test_short {
 		s5.f3 = 3;
 		s5.f4 = 4;
 		s5.f5 = 5;
-		short retval5 = mono_return_short5(s5, 90);
-		if (retval5 != 2*90) {
-			Console.WriteLine("   short5 retval5: got {0} but expected {1}", retval5, 2*90);
+		s5 = mono_return_short5(s5, 90);
+		if (s5.f1 != 1+90) {
+			Console.WriteLine("   short5 s5.f1: got {0} but expected {1}", s5.f1, 1+90);
 			return 1;
 		}
+		if (s5.f2 != 2+90) {
+			Console.WriteLine("   short5 s5.f2: got {0} but expected {1}", s5.f2, 2+90);
+			return 2;
+		}
+		if (s5.f3 != 3+90) {
+			Console.WriteLine("   short5 s5.f3: got {0} but expected {1}", s5.f3, 3+90);
+			return 3;
+		}
+		if (s5.f4 != 4+90) {
+			Console.WriteLine("   short5 s5.f4: got {0} but expected {1}", s5.f4, 4+90);
+			return 4;
+		}
+		if (s5.f5 != 5+90) {
+			Console.WriteLine("   short5 s5.f5: got {0} but expected {1}", s5.f5, 5+90);
+			return 5;
+		}
 
 		short6 s6;
 		s6.f1 = 1;
@@ -152,11 +192,31 @@ public class Test_short {
 		s6.f4 = 4;
 		s6.f5 = 5;
 		s6.f6 = 6;
-		short retval6 = mono_return_short6(s6, 90);
-		if (retval6 != 2*90) {
-			Console.WriteLine("   short6 retval6: got {0} but expected {1}", retval6, 2*90);
+		s6 = mono_return_short6(s6, 90);
+		if (s6.f1 != 1+90) {
+			Console.WriteLine("   short6 s6.f1: got {0} but expected {1}", s6.f1, 1+90);
 			return 1;
 		}
+		if (s6.f2 != 2+90) {
+			Console.WriteLine("   short6 s6.f2: got {0} but expected {1}", s6.f2, 2+90);
+			return 2;
+		}
+		if (s6.f3 != 3+90) {
+			Console.WriteLine("   short6 s6.f3: got {0} but expected {1}", s6.f3, 3+90);
+			return 3;
+		}
+		if (s6.f4 != 4+90) {
+			Console.WriteLine("   short6 s6.f4: got {0} but expected {1}", s6.f4, 4+90);
+			return 4;
+		}
+		if (s6.f5 != 5+90) {
+			Console.WriteLine("   short6 s6.f5: got {0} but expected {1}", s6.f5, 5+90);
+			return 5;
+		}
+		if (s6.f6 != 6+90) {
+			Console.WriteLine("   short6 s6.f6: got {0} but expected {1}", s6.f6, 6+90);
+			return 6;
+		}
 
 		short7 s7;
 		s7.f1 = 1;
@@ -166,11 +226,35 @@ public class Test_short {
 		s7.f5 = 5;
 		s7.f6 = 6;
 		s7.f7 = 7;
-		short retval7 = mono_return_short7(s7, 90);
-		if (retval7 != 2*90) {
-			Console.WriteLine("   short7 retval7: got {0} but expected {1}", retval7, 2*90);
+		s7 = mono_return_short7(s7, 90);
+		if (s7.f1 != 1+90) {
+			Console.WriteLine("   short7 s7.f1: got {0} but expected {1}", s7.f1, 1+90);
 			return 1;
 		}
+		if (s7.f2 != 2+90) {
+			Console.WriteLine("   short7 s7.f2: got {0} but expected {1}", s7.f2, 2+90);
+			return 2;
+		}
+		if (s7.f3 != 3+90) {
+			Console.WriteLine("   short7 s7.f3: got {0} but expected {1}", s7.f3, 3+90);
+			return 3;
+		}
+		if (s7.f4 != 4+90) {
+			Console.WriteLine("   short7 s7.f4: got {0} but expected {1}", s7.f4, 4+90);
+			return 4;
+		}
+		if (s7.f5 != 5+90) {
+			Console.WriteLine("   short7 s7.f5: got {0} but expected {1}", s7.f5, 5+90);
+			return 5;
+		}
+		if (s7.f6 != 6+90) {
+			Console.WriteLine("   short7 s7.f6: got {0} but expected {1}", s7.f6, 6+90);
+			return 6;
+		}
+		if (s7.f7 != 7+90) {
+			Console.WriteLine("   short7 s7.f7: got {0} but expected {1}", s7.f7, 7+90);
+			return 7;
+		}
 
 		short8 s8;
 		s8.f1 = 1;
@@ -181,11 +265,39 @@ public class Test_short {
 		s8.f6 = 6;
 		s8.f7 = 7;
 		s8.f8 = 8;
-		short retval8 = mono_return_short8(s8, 90);
-		if (retval8 != 2*90) {
-			Console.WriteLine("   short8 retval8: got {0} but expected {1}", retval8, 2*90);
+		s8 = mono_return_short8(s8, 90);
+		if (s8.f1 != 1+90) {
+			Console.WriteLine("   short8 s8.f1: got {0} but expected {1}", s8.f1, 1+90);
 			return 1;
 		}
+		if (s8.f2 != 2+90) {
+			Console.WriteLine("   short8 s8.f2: got {0} but expected {1}", s8.f2, 2+90);
+			return 2;
+		}
+		if (s8.f3 != 3+90) {
+			Console.WriteLine("   short8 s8.f3: got {0} but expected {1}", s8.f3, 3+90);
+			return 3;
+		}
+		if (s8.f4 != 4+90) {
+			Console.WriteLine("   short8 s8.f4: got {0} but expected {1}", s8.f4, 4+90);
+			return 4;
+		}
+		if (s8.f5 != 5+90) {
+			Console.WriteLine("   short8 s8.f5: got {0} but expected {1}", s8.f5, 5+90);
+			return 5;
+		}
+		if (s8.f6 != 6+90) {
+			Console.WriteLine("   short8 s8.f6: got {0} but expected {1}", s8.f6, 6+90);
+			return 6;
+		}
+		if (s8.f7 != 7+90) {
+			Console.WriteLine("   short8 s8.f7: got {0} but expected {1}", s8.f7, 7+90);
+			return 7;
+		}
+		if (s8.f8 != 8+90) {
+			Console.WriteLine("   short8 s8.f8: got {0} but expected {1}", s8.f8, 8+90);
+			return 8;
+		}
 
 		short9 s9;
 		s9.f1 = 1;
@@ -197,18 +309,89 @@ public class Test_short {
 		s9.f7 = 7;
 		s9.f8 = 8;
 		s9.f9 = 9;
-		short retval9 = mono_return_short9(s9, 90);
-		if (retval9 != 2*90) {
-			Console.WriteLine("   short9 retval9: got {0} but expected {1}", retval9, 2*90);
+		s9 = mono_return_short9(s9, 90);
+		if (s9.f1 != 1+90) {
+			Console.WriteLine("   short9 s9.f1: got {0} but expected {1}", s9.f1, 1+90);
 			return 1;
 		}
+		if (s9.f2 != 2+90) {
+			Console.WriteLine("   short9 s9.f2: got {0} but expected {1}", s9.f2, 2+90);
+			return 2;
+		}
+		if (s9.f3 != 3+90) {
+			Console.WriteLine("   short9 s9.f3: got {0} but expected {1}", s9.f3, 3+90);
+			return 3;
+		}
+		if (s9.f4 != 4+90) {
+			Console.WriteLine("   short9 s9.f4: got {0} but expected {1}", s9.f4, 4+90);
+			return 4;
+		}
+		if (s9.f5 != 5+90) {
+			Console.WriteLine("   short9 s9.f5: got {0} but expected {1}", s9.f5, 5+90);
+			return 5;
+		}
+		if (s9.f6 != 6+90) {
+			Console.WriteLine("   short9 s9.f6: got {0} but expected {1}", s9.f6, 6+90);
+			return 6;
+		}
+		if (s9.f7 != 7+90) {
+			Console.WriteLine("   short9 s9.f7: got {0} but expected {1}", s9.f7, 7+90);
+			return 7;
+		}
+		if (s9.f8 != 8+90) {
+			Console.WriteLine("   short9 s9.f8: got {0} but expected {1}", s9.f8, 8+90);
+			return 8;
+		}
+		if (s9.f9 != 9+90) {
+			Console.WriteLine("   short9 s9.f9: got {0} but expected {1}", s9.f9, 9+90);
+			return 9;
+		}
 
 
+		short8_nested sn8;
+		sn8.nested1.f1 = 1;
+		sn8.f2 = 2;
+		sn8.f3 = 3;
+		sn8.f4 = 4;
+		sn8.f5 = 5;
+		sn8.f6 = 6;
+		sn8.f7 = 7;
+		sn8.nested2.f8 = 8;
+		sn8 = mono_return_short8_nested(sn8, 90);
+		if (sn8.nested1.f1 != 1+90) {
+			Console.WriteLine("   short8_nested sn8.nested1.f1: got {0} but expected {1}", sn8.nested1.f1, 1+90);
+			return 1;
+		}
+		if (sn8.f2 != 2+90) {
+			Console.WriteLine("   short8_nested sn8.f2: got {0} but expected {1}", sn8.f2, 2+90);
+			return 2;
+		}
+		if (sn8.f3 != 3+90) {
+			Console.WriteLine("   short8_nested sn8.f3: got {0} but expected {1}", sn8.f3, 3+90);
+			return 3;
+		}
+		if (sn8.f4 != 4+90) {
+			Console.WriteLine("   short8_nested sn8.f4: got {0} but expected {1}", sn8.f4, 4+90);
+			return 4;
+		}
+		if (sn8.f5 != 5+90) {
+			Console.WriteLine("   short8_nested sn8.f5: got {0} but expected {1}", sn8.f5, 5+90);
+			return 5;
+		}
+		if (sn8.f6 != 6+90) {
+			Console.WriteLine("   short8_nested sn8.f6: got {0} but expected {1}", sn8.f6, 6+90);
+			return 6;
+		}
+		if (sn8.f7 != 7+90) {
+			Console.WriteLine("   short8_nested sn8.f7: got {0} but expected {1}", sn8.f7, 7+90);
+			return 7;
+		}
+		if (sn8.nested2.f8 != 8+90) {
+			Console.WriteLine("   short8_nested sn8.nested2.f8: got {0} but expected {1}", sn8.nested2.f8, 8+90);
+			return 8;
+		}
+
 		return 0;
 	} // end Main
 } // end class Test_short
 
-
-
-
-