-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[NativeAOT] Convert operand of newarr to int when producing reverse P/Invoke array marshalling #98025
[NativeAOT] Convert operand of newarr to int when producing reverse P/Invoke array marshalling #98025
Conversation
…ke array marshalling
Most uses of EmitElementCount seem to assume int32 though. I think the bug is that we have a couple (two that I saw) places that store it into an Weird that this shows up as a problem on 32bit platform. I would expect it to show up on 64bit due to size differences. |
The IL opcode
On 64-bit platforms it happens to work with any size of int but on 32-bit ones this gets hit for I can change it to |
Huh, that's weird. ECMA-335 spec says int32 or nint and normally one would see int32. Here we store the result into int32: runtime/src/coreclr/tools/Common/TypeSystem/Interop/IL/Marshaller.cs Lines 1142 to 1144 in 0842930
If I'm reading it right, coreclr will convert to i4 with overflow checking: runtime/src/coreclr/vm/ilmarshalers.cpp Line 4160 in a715719
|
Let's match CoreCLR then. |
Nice quote to have as a code comment! 😉 |
Fixes the following error on linux-arm (#98022):