Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Mayr <mayr_michael@gmx.at>2017-06-09 22:02:19 +0300
committerJan Kotas <jkotas@microsoft.com>2017-06-09 22:02:19 +0300
commit2928e63d8ebd62146c6e94dc3e258c59e598b2c9 (patch)
tree0bdcaabee1ab7d08c59e85350c485bc607b54f63
parent570d7b9b7ace5349707a39d62e914b32ea5ed3d5 (diff)
[ILVerify] Added special handling for null values in ImportStoreIndirect (#3846)
-rw-r--r--src/ILVerify/src/ILImporter.StackValue.cs5
-rw-r--r--src/ILVerify/src/ILImporter.Verify.cs4
-rw-r--r--src/ILVerify/tests/ILTests/LoadStoreIndirectTest.il11
3 files changed, 19 insertions, 1 deletions
diff --git a/src/ILVerify/src/ILImporter.StackValue.cs b/src/ILVerify/src/ILImporter.StackValue.cs
index 4c1afe5f5..d4fb4d835 100644
--- a/src/ILVerify/src/ILImporter.StackValue.cs
+++ b/src/ILVerify/src/ILImporter.StackValue.cs
@@ -39,6 +39,11 @@ namespace Internal.IL
get { return (Flags & StackValueFlags.ReadOnly) == StackValueFlags.ReadOnly; }
}
+ public bool IsNullReference
+ {
+ get { return Kind == StackValueKind.ObjRef && Type == null; }
+ }
+
public StackValue DereferenceByRef()
{
Debug.Assert(Kind == StackValueKind.ByRef && Type != null, "Cannot dereference");
diff --git a/src/ILVerify/src/ILImporter.Verify.cs b/src/ILVerify/src/ILImporter.Verify.cs
index 9f7a604ee..806980e8f 100644
--- a/src/ILVerify/src/ILImporter.Verify.cs
+++ b/src/ILVerify/src/ILImporter.Verify.cs
@@ -1279,7 +1279,9 @@ namespace Internal.IL
Check(!address.IsReadOnly, VerifierError.ReadOnlyIllegalWrite);
CheckIsByRef(address);
- CheckIsAssignable(type, address.Type);
+ if (!value.IsNullReference)
+ CheckIsAssignable(type, address.Type);
+
CheckIsAssignable(value, StackValue.CreateFromType(type));
}
diff --git a/src/ILVerify/tests/ILTests/LoadStoreIndirectTest.il b/src/ILVerify/tests/ILTests/LoadStoreIndirectTest.il
index 4a9da1ad8..7450a3499 100644
--- a/src/ILVerify/tests/ILTests/LoadStoreIndirectTest.il
+++ b/src/ILVerify/tests/ILTests/LoadStoreIndirectTest.il
@@ -71,6 +71,17 @@
ret
}
+ .method static public hidebysig void StoreIndirect.AssignNullToRefString_Valid(string&) cil managed
+ {
+ // ref string x;
+ // x = null;
+
+ ldarg.0
+ ldnull
+ stind.ref
+ ret
+ }
+
.method static public hidebysig void StoreObject.ValidTypeToken_Valid() cil managed
{
.locals init (object V_0)