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:
authorSamuel Arzt <arzt.samuel@live.de>2018-01-04 18:40:50 +0300
committerJan Kotas <jkotas@microsoft.com>2018-01-04 18:40:50 +0300
commitf9e1c4f5eb36671d31b97aa7b01d46ff97e2ed0d (patch)
tree735aa5f622c9bea1ef77f66c20f67a8f415cc3ee /src/ILVerify
parent689362c41c747b1c6b684ff76d5e321a5636978f (diff)
[ILVerify] Fix backward branching rule using signed byte for short-branch deltas (#5202)
* Added test case for backwards brfalse_s. * Fixed MarkPredecessorWithLowerOffset using unsigned byte for short deltas.
Diffstat (limited to 'src/ILVerify')
-rw-r--r--src/ILVerify/src/ILImporter.Verify.cs4
-rw-r--r--src/ILVerify/tests/ILTests/BranchingTests.il12
2 files changed, 14 insertions, 2 deletions
diff --git a/src/ILVerify/src/ILImporter.Verify.cs b/src/ILVerify/src/ILImporter.Verify.cs
index 9d3d128ec..5dde3d6f3 100644
--- a/src/ILVerify/src/ILImporter.Verify.cs
+++ b/src/ILVerify/src/ILImporter.Verify.cs
@@ -364,7 +364,7 @@ again:
break;
case ILOpcode.br_s:
case ILOpcode.leave_s:
- MarkPredecessorWithLowerOffset(ReadILByte());
+ MarkPredecessorWithLowerOffset((sbyte)ReadILByte());
continue;
case ILOpcode.brfalse_s:
case ILOpcode.brtrue_s:
@@ -378,7 +378,7 @@ again:
case ILOpcode.bgt_un_s:
case ILOpcode.ble_un_s:
case ILOpcode.blt_un_s:
- MarkPredecessorWithLowerOffset(ReadILByte());
+ MarkPredecessorWithLowerOffset((sbyte)ReadILByte());
break;
case ILOpcode.switch_:
{
diff --git a/src/ILVerify/tests/ILTests/BranchingTests.il b/src/ILVerify/tests/ILTests/BranchingTests.il
index e184c9011..dd5258c22 100644
--- a/src/ILVerify/tests/ILTests/BranchingTests.il
+++ b/src/ILVerify/tests/ILTests/BranchingTests.il
@@ -966,6 +966,18 @@
ret
}
+ .method static public hidebysig void BrFalseS.Backward_Valid() cil managed
+ {
+ BackwardBranch:
+ // Note: additional nops to increase branch delta
+ nop
+ nop
+ ldc.i4.0
+ brfalse.s BackwardBranch
+
+ ret
+ }
+
.method static public hidebysig void Branch.BackwardEmptyStack_Valid() cil managed
{
br MethodEnd