blob: 5a5c921b5bc28aa3b22e17d45a5f74b2d0ba663e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
//
// Ensure bounds checks aren't elided for this do-while loop.
//
// Reference: TF Bug 150041
using System;
using System.Runtime.ExceptionServices;
public class Program
{
[HandleProcessCorruptedStateExceptions]
public static int Main()
{
int ret = 99;
try
{
int[] a = new int[0];
int i = 0x1FFFFFFF;
do
{
a[i] = 0;
++i;
}
while (i < a.Length);
}
catch (Exception e)
{
if (e is IndexOutOfRangeException)
{
ret = 100;
}
}
return ret;
}
}
|