Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
257 changes: 115 additions & 142 deletions src/tests/JIT/Regression/CLR-x86-JIT/V1-M15-SP2/b124443/b124443.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,151 +4,124 @@

using System;
using Xunit;
delegate void TestDelegate();

public class ArrayBounds
{
internal static void f1a()
{
int [] a = new int[4];
for (int i=0; i < a.Length; --i)
{
a[i]=1;
}
}
internal static void f2a()
{
int [] a = new int[4];
for (int i=0; i < a.Length; --i)
{
int b = a[i];
}
}
internal static void f3a()
{
int [] a = new int[4];
for (int i=0; i < a.Length; --i)
{
Console.WriteLine(a[i]);
}
}
internal static void f4a()
{
int [] a = new int[4];
for (int i=0; i < a.Length; a[i]=i,--i)
{
// empty
}
}

// ++i
internal static void f1b()
{
int [] a = new int[4];
for (int i=0; i <= a.Length; ++i)
{
a[i]=1;
}
}
internal static void f2b()
{
int [] a = new int[4];
for (int i=0; i <= a.Length; ++i)
{
int b = a[i];
}
}
internal static void f3b()
{
int [] a = new int[4];
for (int i=0; i <= a.Length; ++i)
{
Console.WriteLine(a[i]);
}
}
internal static void f4b()
{
int [] a = new int[4];
for (int i=0; i <= a.Length; a[i]=i,++i)
{
// empty
}
}

// ++i, 0x7fff
internal static void f1c()
{
bool [] a = new bool[0x7fff];
for (short i=0x7ff0; i < a.Length+1; ++i)
{
a[i]=true;
}
}
internal static void f2c()
{
bool [] a = new bool[0x7fff];
for (short i=0x7ff0; i < a.Length+1; ++i)
{
bool b = a[i];
}
}
internal static void f3c()
{
bool [] a = new bool[0x7fff];
for (short i=0x7ffe; i < a.Length+1; ++i)
{
Console.WriteLine(a[i]);
}
}
internal static void f4c()
{
bool [] a = new bool[0x7fff];
for (short i=0x7ff0; i < a.Length+1; ++i)
{
a[i] = true;
}
}

static int RunTests(TestDelegate d)
{
try
{
Console.Write(d.Method.Name + ": ");
d();
}
catch (IndexOutOfRangeException)
{
Console.WriteLine("IndexOutOfRangeException caught as expected");
return 100;
}
catch (Exception e)
{
Console.WriteLine("FAILED");
Console.WriteLine(e);
return 1;
}
internal static void f1a()
{
int [] a = new int[4];
for (int i=0; i < a.Length; --i)
{
a[i]=1;
}
}
internal static void f2a()
{
int [] a = new int[4];
for (int i=0; i < a.Length; --i)
{
int b = a[i];
}
}
internal static void f3a()
{
int [] a = new int[4];
for (int i=0; i < a.Length; --i)
{
Console.WriteLine(a[i]);
}
}
internal static void f4a()
{
int [] a = new int[4];
for (int i=0; i < a.Length; a[i]=i,--i)
{
// empty
}
}

Console.WriteLine("PASSED");
return 100;
}
// ++i
internal static void f1b()
{
int [] a = new int[4];
for (int i=0; i <= a.Length; ++i)
{
a[i]=1;
}
}
internal static void f2b()
{
int [] a = new int[4];
for (int i=0; i <= a.Length; ++i)
{
int b = a[i];
}
}
internal static void f3b()
{
int [] a = new int[4];
for (int i=0; i <= a.Length; ++i)
{
Console.WriteLine(a[i]);
}
}
internal static void f4b()
{
int [] a = new int[4];
for (int i=0; i <= a.Length; a[i]=i,++i)
{
// empty
}
}

[Fact]
public static int TestEntryPoint()
{
if (RunTests(new TestDelegate(f1a))!=100) return 1;
if (RunTests(new TestDelegate(f2a))!=100) return 1;
if (RunTests(new TestDelegate(f3a))!=100) return 1;
if (RunTests(new TestDelegate(f4a))!=100) return 1;
if (RunTests(new TestDelegate(f1b))!=100) return 1;
if (RunTests(new TestDelegate(f2b))!=100) return 1;
if (RunTests(new TestDelegate(f3b))!=100) return 1;
if (RunTests(new TestDelegate(f4b))!=100) return 1;
if (RunTests(new TestDelegate(f1c))!=100) return 1;
if (RunTests(new TestDelegate(f2c))!=100) return 1;
if (RunTests(new TestDelegate(f3c))!=100) return 1;
if (RunTests(new TestDelegate(f4c))!=100) return 1;
// ++i, 0x7fff
internal static void f1c()
{
bool [] a = new bool[0x7fff];
for (short i=0x7ff0; i < a.Length+1; ++i)
{
a[i]=true;
}
}
internal static void f2c()
{
bool [] a = new bool[0x7fff];
for (short i=0x7ff0; i < a.Length+1; ++i)
{
bool b = a[i];
}
}
internal static void f3c()
{
bool [] a = new bool[0x7fff];
for (short i=0x7ffe; i < a.Length+1; ++i)
{
Console.WriteLine(a[i]);
}
}
internal static void f4c()
{
bool [] a = new bool[0x7fff];
for (short i=0x7ff0; i < a.Length+1; ++i)
{
a[i] = true;
}
}

Console.WriteLine();
Console.WriteLine("PASSED");
return 100;
}
[Fact]
public static void TestEntryPoint()
{
Assert.Throws<IndexOutOfRangeException>(f1a);
Assert.Throws<IndexOutOfRangeException>(f2a);
Assert.Throws<IndexOutOfRangeException>(f3a);
Assert.Throws<IndexOutOfRangeException>(f4a);
Assert.Throws<IndexOutOfRangeException>(f1b);
Assert.Throws<IndexOutOfRangeException>(f2b);
Assert.Throws<IndexOutOfRangeException>(f3b);
Assert.Throws<IndexOutOfRangeException>(f4b);
Assert.Throws<IndexOutOfRangeException>(f1c);
Assert.Throws<IndexOutOfRangeException>(f2c);
Assert.Throws<IndexOutOfRangeException>(f3c);
Assert.Throws<IndexOutOfRangeException>(f4c);
}
}
17 changes: 1 addition & 16 deletions src/tests/JIT/Regression/JitBlue/DevDiv_278365/DevDiv_278365.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
public class Program
{
[MethodImpl(MethodImplOptions.NoInlining)]
[Fact]
public static int Bar()
{
int sum = 0;
Expand All @@ -31,20 +32,4 @@ public static int Bar()
return 100;
}
}

[Fact]
public static int TestEntryPoint()
{
try
{
if (Bar() != 100)
return 0;
}
catch (Exception)
{
}

Console.WriteLine("Pass");
return 100;
}
}
57 changes: 12 additions & 45 deletions src/tests/JIT/Regression/JitBlue/Runtime_46240/Runtime_46240.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public static S<T> GetS()
}

[MethodImpl(MethodImplOptions.NoInlining)]
public static int TestS()
public static void TestS()
{
// Use all available registers to push some locals on stack
// and force multi-reg->stack copies with small types
Expand All @@ -58,56 +58,23 @@ public static int TestS()
TestS(s3);
TestS(s2);
TestS(s1);

return 100;
}
}

public class Runtime_46240
{
[Fact]
public static int TestEntryPoint()
public static void TestEntryPoint()
{
if (Tester<byte>.TestS() != 100)
{
return 101;
}
if (Tester<sbyte>.TestS() != 100)
{
return 101;
}
if (Tester<ushort>.TestS() != 100)
{
return 101;
}
if (Tester<short>.TestS() != 100)
{
return 101;
}
if (Tester<uint>.TestS() != 100)
{
return 101;
}
if (Tester<int>.TestS() != 100)
{
return 101;
}
if (Tester<ulong>.TestS() != 100)
{
return 101;
}
if (Tester<long>.TestS() != 100)
{
return 101;
}
if (Tester<float>.TestS() != 100)
{
return 101;
}
if (Tester<double>.TestS() != 100)
{
return 101;
}
return 100;
Tester<byte>.TestS();
Tester<sbyte>.TestS();
Tester<ushort>.TestS();
Tester<short>.TestS();
Tester<uint>.TestS();
Tester<int>.TestS();
Tester<ulong>.TestS();
Tester<long>.TestS();
Tester<float>.TestS();
Tester<double>.TestS();
}
}
Loading