File tree 3 files changed +60
-0
lines changed
tests/JIT/Methodical/Arrays/misc 3 files changed +60
-0
lines changed Original file line number Diff line number Diff line change @@ -6464,6 +6464,7 @@ bool GenTree::OperMayThrow(Compiler* comp)
6464
6464
case GT_ARR_OFFSET:
6465
6465
case GT_LCLHEAP:
6466
6466
case GT_CKFINITE:
6467
+ case GT_INDEX:
6467
6468
case GT_INDEX_ADDR:
6468
6469
return true;
6469
6470
Original file line number Diff line number Diff line change
1
+ // Licensed to the .NET Foundation under one or more agreements.
2
+ // The .NET Foundation licenses this file to you under the MIT license.
3
+
4
+ using System ;
5
+ using System . Runtime . CompilerServices ;
6
+ using Xunit ;
7
+
8
+ public class IndexingSideEffects
9
+ {
10
+ [ Fact ]
11
+ public static int TestEntryPoint ( )
12
+ {
13
+ if ( ! Problem ( ) )
14
+ {
15
+ return 101 ;
16
+ }
17
+
18
+ return 100 ;
19
+ }
20
+
21
+ [ MethodImpl ( MethodImplOptions . NoInlining ) ]
22
+ private static bool Problem ( )
23
+ {
24
+ bool result = false ;
25
+
26
+ try
27
+ {
28
+ TryIndexing ( new int [ 0 ] ) ;
29
+ }
30
+ catch ( IndexOutOfRangeException )
31
+ {
32
+ result = true ;
33
+ }
34
+
35
+ return result ;
36
+ }
37
+
38
+ [ MethodImpl ( MethodImplOptions . NoInlining ) ]
39
+ private static void TryIndexing ( int [ ] a )
40
+ {
41
+ // Make sure that early flowgraph simplification does not remove the side effect of indexing
42
+ // when deleting the relop.
43
+ if ( a [ int . MaxValue ] == 0 )
44
+ {
45
+ NopInlinedCall ( ) ;
46
+ }
47
+ }
48
+
49
+ private static void NopInlinedCall ( ) { }
50
+ }
Original file line number Diff line number Diff line change
1
+ <Project Sdk =" Microsoft.NET.Sdk" >
2
+ <PropertyGroup >
3
+ <DebugType >None</DebugType >
4
+ <Optimize >True</Optimize >
5
+ </PropertyGroup >
6
+ <ItemGroup >
7
+ <Compile Include =" $(MSBuildProjectName).cs" />
8
+ </ItemGroup >
9
+ </Project >
You can’t perform that action at this time.
0 commit comments