2007-10-19 Marek Habersack <mhabersack@novell.com>
[mono.git] / mono / mini / objects.cs
index ef3585213b5cdd525cb2761929933dab7f561d1a..3bc0a03b4fc2522810433079213f6e6e6c08748f 100644 (file)
@@ -1,4 +1,5 @@
 using System;
+using System.Text;
 using System.Reflection;
 using System.Runtime.InteropServices;
 using System.Runtime.CompilerServices;
@@ -37,6 +38,12 @@ struct Small {
        public byte b2;
 }
 
+// Size=2, Align=1
+struct Foo {
+       bool b1;
+       bool b2;
+}
+
 struct Large {
        int one;
        int two;
@@ -242,17 +249,27 @@ class Tests {
                return 0;
        }
 
+       static int receive_small_sparc_many_args (int a, int a2, int a3, int a4, int a5, int a6, Small v, int b) {
+               if (v.b1 != 1)
+                       return 1;
+               if (v.b2 != 2)
+                       return 2;
+               return 0;
+       }
+
        static int test_5_pass_small_struct () {
                Small v = get_small (1);
                if (receive_small (7, v, 9) != 0)
                        return 0;
                if (receive_small (7, get_small (1), 9) != 0)
                        return 1;
+               if (receive_small_sparc_many_args (1, 2, 3, 4, 5, 6, v, 9) != 0)
+                       return 2;
                v = return_small (v);
                if (v.b1 != 1)
-                       return 2;
-               if (v.b2 != 2)
                        return 3;
+               if (v.b2 != 2)
+                       return 4;
                return 5;
        }
 
@@ -994,5 +1011,42 @@ ncells ) {
                
                return i - i;
        }
+
+       static int test_0_intrins_string_setchar () {
+               StringBuilder sb = new StringBuilder ("ABC");
+
+               sb [1] = 'D';
+
+               return sb.ToString () == "ADC" ? 0 : 1;
+       }
+
+       public class Bar {
+               bool allowLocation = true;
+        Foo f = new Foo ();    
+       }
+
+       static int test_0_regress_78990_unaligned_structs () {
+               new Bar ();
+
+               return 0;
+       }
+
+       static unsafe int test_97_negative_index () {
+               char[] arr = new char[] {'a', 'b'};
+               fixed (char *p = arr) {
+                       char *i = p + 2;
+                       char a = i[-2];
+                       return a;
+               }
+       }
+
+       /* bug #82281 */
+       static int test_0_unsigned_right_shift_imm0 () {
+               uint temp = 0;
+               byte[] data = new byte[256];
+               for (int i = 0; i < 1; i ++)
+                       temp = (uint)(data[temp >> 24] | data[temp >> 0]);
+               return 0;
+       }
 }