diff options
author | Denis Proshutinskii <36221916+jl0pd@users.noreply.github.com> | 2022-08-01 11:12:24 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-01 11:12:24 +0300 |
commit | 65af9d037bf88e3cfc97b8ff61dfb19c4e874365 (patch) | |
tree | b920ff0e32d6e968d6aa192e23b5d93c6d5cc588 /src/tests/ilverify | |
parent | cfa4f6f26e303eb0f0f67e3798fcf005e0124092 (diff) |
Add localloc empty stack verification (#73109)
* Add localloc empty stack verification
* Update error message
* Add more tests
* Fix tests
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
Co-authored-by: Dan Moseley <danmose@microsoft.com>
Diffstat (limited to 'src/tests/ilverify')
-rw-r--r-- | src/tests/ilverify/ILTests/DefaultInterfaceMethod.il | 2 | ||||
-rw-r--r-- | src/tests/ilverify/ILTests/LocalAllocTests.il | 43 | ||||
-rw-r--r-- | src/tests/ilverify/ILTests/LocalAllocTests.ilproj | 3 |
3 files changed, 47 insertions, 1 deletions
diff --git a/src/tests/ilverify/ILTests/DefaultInterfaceMethod.il b/src/tests/ilverify/ILTests/DefaultInterfaceMethod.il index a33f5cdddbe..afd4f59d21e 100644 --- a/src/tests/ilverify/ILTests/DefaultInterfaceMethod.il +++ b/src/tests/ilverify/ILTests/DefaultInterfaceMethod.il @@ -107,7 +107,7 @@ } } -.class public auto ansi beforefieldinit ChildClassInheritsFromInterfaceWithDefaultImplementationWhereChildInterfaceReabstractsInterfaceMethod_InvalidType_InterfaceMethodNotImplemented +.class public auto ansi beforefieldinit ChildClassInheritsFromInterfaceWithDefaultImplementationWhereChildInterfaceReabstractsInterfaceMethod_InvalidType_InterfaceMethodNotImplemented@InterfaceMethodNotImplemented extends [System.Runtime]System.Object implements IReabstractDefaultImplementation, IInheritedDefaultImplInterface, IInterface { diff --git a/src/tests/ilverify/ILTests/LocalAllocTests.il b/src/tests/ilverify/ILTests/LocalAllocTests.il new file mode 100644 index 00000000000..5789906868b --- /dev/null +++ b/src/tests/ilverify/ILTests/LocalAllocTests.il @@ -0,0 +1,43 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +.assembly extern System.Runtime +{ +} + +.assembly extern LocalAllocTestsFriend +{ +} + +.assembly LocalAllocTests +{ +} + +.class public auto ansi beforefieldinit LocAllocTests + extends [System.Runtime]System.Object +{ + .method private hidebysig instance void Load.LocAllocShouldFailWhenStackNotEmpty_Invalid_Unverifiable.LocallocStackNotEmpty() cil managed + { + ldnull // pretend there's meaningfull value on stack + ldc.i4.2 // size parameter for localloc + localloc + pop // pop localloc pointer + pop // pop ldnull + ret + } + + .method private hidebysig instance void Load.LocAllocShouldFailWhenSizeIsAbsent_Invalid_Unverifiable.StackUnderflow() cil managed + { + localloc + pop // pop localloc pointer + ret + } + + .method private hidebysig instance void Load.LocAllocShouldSuccesWhenSizeIsPresent_Invalid_Unverifiable() cil managed + { + ldc.i4.2 // size parameter for localloc + localloc + pop // pop localloc pointer + ret + } +} diff --git a/src/tests/ilverify/ILTests/LocalAllocTests.ilproj b/src/tests/ilverify/ILTests/LocalAllocTests.ilproj new file mode 100644 index 00000000000..8e8765d14a5 --- /dev/null +++ b/src/tests/ilverify/ILTests/LocalAllocTests.ilproj @@ -0,0 +1,3 @@ +<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="ILTests.targets" /> +</Project> |