X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Fmini%2Farrays.cs;h=00a3c6b901f86a6b0c92e4b9a2993dbb447f3e78;hb=5e1d20ac48917f8e777f99524b5c1994431b2228;hp=9598aa735cb3f18b51138b53a1e4b028c811b285;hpb=9b2e52a86a4191314a3dc690e046d74cf766927e;p=mono.git diff --git a/mono/mini/arrays.cs b/mono/mini/arrays.cs index 9598aa735cb..00a3c6b901f 100644 --- a/mono/mini/arrays.cs +++ b/mono/mini/arrays.cs @@ -23,14 +23,14 @@ using System.Reflection; * the IL code looks. */ -#if MOBILE +#if __MOBILE__ class ArrayTests #else class Tests #endif { -#if !MOBILE +#if !__MOBILE__ public static int Main (string[] args) { return TestDriver.RunTests (typeof (Tests), args); } @@ -766,7 +766,46 @@ class Tests test[x+100,y+100] = true; } return 0; - } + } + + static bool alloc_long (long l) { + try { + var arr = new byte[l]; + return false; + } catch (Exception e) { + return true; + } + } + + // #13544 + public static int test_0_newarr_ovf () { + if (!alloc_long (5000000000)) + return 1; + if (!alloc_long (4000000000)) + return 2; + if (!alloc_long (-1)) + return 3; + if (!alloc_long (-4000000000)) + return 4; + if (!alloc_long (-6000000000)) + return 5; + return 0; + } + + static int llvm_ldlen_licm (int[] arr) { + int sum = 0; + // The ldlen should be moved out of the loop + for (int i = 0; i < arr.Length; ++i) + sum += arr [i]; + return sum; + } + + public static int test_10_llvm_ldlen_licm () { + int[] arr = new int [10]; + for (int i = 0; i < 10; ++i) + arr [i] = 1; + return llvm_ldlen_licm (arr); + } }