From 7e57bbe4bcd464c76ef704d85ce922003d4fbbd2 Mon Sep 17 00:00:00 2001 From: Gleb Balykov Date: Wed, 2 Mar 2022 22:37:30 +0300 Subject: [PATCH] [Tizen] Revert "Pass zero length array as null" https://github.com/dotnet/coreclr/pull/27555 Without this revert two coreclr tests fail if they are compiled with inputbubble and IL_STUB saving in ni: - Interop/PInvoke/Array/MarshalArrayAsParam/AsDefault/AsDefaultTest/AsDefaultTest.sh - Interop/PInvoke/Array/MarshalArrayAsParam/AsLPArray/AsLPArrayTest/AsLPArrayTest.sh For both tests problem is exactly with array with 0 length, which is passed as NULL to native function. But it should be a pointer to the non-existing element, and IL_STUB generated at runtime does exactly this. --- src/coreclr/tools/Common/TypeSystem/Interop/IL/Marshaller.cs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/coreclr/tools/Common/TypeSystem/Interop/IL/Marshaller.cs b/src/coreclr/tools/Common/TypeSystem/Interop/IL/Marshaller.cs index 404f655..e34fd17 100644 --- a/src/coreclr/tools/Common/TypeSystem/Interop/IL/Marshaller.cs +++ b/src/coreclr/tools/Common/TypeSystem/Interop/IL/Marshaller.cs @@ -1375,11 +1375,6 @@ namespace Internal.TypeSystem.Interop ILLocalVariable vPinnedFirstElement = emitter.NewLocal(ManagedElementType.MakeByRefType(), true); LoadManagedValue(codeStream); - codeStream.Emit(ILOpcode.ldlen); - codeStream.Emit(ILOpcode.conv_i4); - codeStream.Emit(ILOpcode.brfalse, lNullArray); - - LoadManagedValue(codeStream); codeStream.Emit(ILOpcode.call, emitter.NewToken(getArrayDataReferenceMethod)); codeStream.EmitStLoc(vPinnedFirstElement); -- 2.7.4