runtime: Assertion failed '!inlineeLocal.lclIsPinned'

See IL repro at the bottom. Please let me know if you need more info, or a repro of a different form. This assert is seen on 479 real assemblies from NuGet.org. This IL pattern seems to be an older pattern formerly produced by csc for fixed blocks, but the code for the packages I could find no longer produces this pattern on recent compilers (there is a &int32 that is pinned rather than the int32*).

Save the IL below as test.il ilasm test.il /dll run amd64 CHK crossgen on test.dll: crossgen.exe /in test.dll /out test.ni /nologo /verbose /platform_assemblies_paths “paths_to_il” Expected: successful compilation Actual:

Opening input file
Preloading input file D:\scratch\crossgenrepros\!inlineeLocal.lclIsPinned\test.dll
Compiling input file D:\scratch\crossgenrepros\!inlineeLocal.lclIsPinned\test.dll
Compiling method Program.Main

Assert failure(PID 30140 [0x000075bc], Thread: 25608 [0x6408]): Assertion failed '!inlineeLocal.lclIsPinned' in 'Program:Main(ref):int' (IL size 12)

    File: c:\users\markmil\source\repos\coreclr\src\jit\importer.cpp Line: 19084
    Image: C:\Users\markmil\Source\Repos\PMIExperiment\CrossGenner\bin\Debug\netcoreapp3.0\coreclr\crossgen.exe

IL Repro:

.assembly extern mscorlib
{
  .publickeytoken = (B7 7A 5C 56 19 34 E0 89 )                         // .z\V.4..
  .ver 4:0:0:0
}

.assembly Test
{
  .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 ) 
  .custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78   // ....T..WrapNonEx
                                                                                                             63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 )       // ceptionThrows.
  .hash algorithm 0x00008004
  .ver 1:0:0:0
}
.module Test.dll
.imagebase 0x00400000
.file alignment 0x00000200
.stackreserve 0x00100000
.subsystem 0x0003       // WINDOWS_CUI
.corflags 0x00020003    //  ILONLY 32BITPREFERRED

.class public sequential ansi sealed beforefieldinit Program
	extends [mscorlib]System.Object
{
	.method private hidebysig static 
		int32 Main (
			string[] args
		) cil managed 
	{

		.maxstack 1
		.entrypoint
		.locals init (
			[0] int32
		)
		nop
		ldc.i4.s 100
		stloc.0
		ldloca.s 0
		call int32 Program::GetValueUnsafe(int32&)
		ret
	}

	.method private hidebysig 
		static int32 GetValueUnsafe (
			int32& buffer
		) cil managed 
	{
		.maxstack 3
		.locals init (
			[0] int32* pinned
		)

		ldarg.0
		stloc.0
		ldloc.0
		ldind.i4
		ret
	}
}

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 17 (14 by maintainers)

Commits related to this issue

Most upvoted comments

I’m planning on broadening out the current nulling code to handle these – it is relatively straightforward.