File tree Expand file tree Collapse file tree 3 files changed +79
-1
lines changed
tests/JIT/Regression/JitBlue/Runtime_88950 Expand file tree Collapse file tree 3 files changed +79
-1
lines changed Original file line number Diff line number Diff line change @@ -1133,7 +1133,7 @@ class LocalAddressVisitor final : public GenTreeVisitor<LocalAddressVisitor>
11331133 }
11341134#endif // FEATURE_HW_INTRINSICS
11351135
1136- if (!isDef)
1136+ if (( !isDef) && (offset == 0 ) )
11371137 {
11381138 if (varTypeIsIntegral (indir) && varTypeIsIntegral (varDsc))
11391139 {
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 Runtime_88950
9+ {
10+ internal readonly struct Example
11+ {
12+ public readonly object ? Value ;
13+ public readonly ulong Inner ;
14+
15+ struct ExampleInner
16+ {
17+ public int Offset ;
18+ public int Length ;
19+ }
20+
21+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
22+ public Example ( object ? value , int offset , int length )
23+ {
24+ var inner = new ExampleInner
25+ {
26+ Offset = offset ,
27+ Length = length
28+ } ;
29+
30+ Value = value ;
31+ Inner = Unsafe . As < ExampleInner , ulong > ( ref inner ) ;
32+ }
33+ public int Offset
34+ {
35+ [ MethodImpl ( MethodImplOptions . AggressiveOptimization | MethodImplOptions . NoInlining ) ]
36+ get
37+ {
38+ var inner = Inner ;
39+ return Unsafe . As < ulong , ExampleInner > ( ref inner ) . Offset ;
40+ }
41+ }
42+
43+ public int Length
44+ {
45+ [ MethodImpl ( MethodImplOptions . AggressiveOptimization | MethodImplOptions . NoInlining ) ]
46+ get
47+ {
48+ ulong inner = Inner ;
49+ return Unsafe . As < ulong , ExampleInner > ( ref inner ) . Length ;
50+ }
51+ }
52+ }
53+
54+ [ Fact ]
55+ public static int TestEntryPoint ( )
56+ {
57+ var repro = new Example ( new object ( ) , 1234 , 5678 ) ;
58+ if ( repro . Offset != 1234 )
59+ {
60+ Console . WriteLine ( $ "Offset: { repro . Offset } ") ;
61+ return 1 ;
62+ }
63+ if ( repro . Length != 5678 )
64+ {
65+ Console . WriteLine ( $ "Length: { repro . Length } ") ;
66+ return 2 ;
67+ }
68+ return 100 ;
69+ }
70+ }
Original file line number Diff line number Diff line change 1+ <Project Sdk =" Microsoft.NET.Sdk" >
2+ <PropertyGroup >
3+ <Optimize >True</Optimize >
4+ </PropertyGroup >
5+ <ItemGroup >
6+ <Compile Include =" $(MSBuildProjectName).cs" />
7+ </ItemGroup >
8+ </Project >
You can’t perform that action at this time.
0 commit comments