diff options
author | Jeff Greene <hippiehunterenator@gmail.com> | 2018-02-04 04:53:26 +0300 |
---|---|---|
committer | Morgan Brown <morganbr@users.noreply.github.com> | 2018-02-04 04:53:26 +0300 |
commit | e89bb7a087f26031f173ade1f57d01bef7c9f685 (patch) | |
tree | 0b5adc97c77087f56a515d14d4485ceb64179f34 /tests | |
parent | f19daaae780f2b0b2675792a8b0ef071dc1e58ff (diff) |
Fixed ldind failure and properly zext unsigned types that are smaller than 32bit (#5342)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/src/Simple/HelloWasm/Program.cs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/src/Simple/HelloWasm/Program.cs b/tests/src/Simple/HelloWasm/Program.cs index bb8962c12..612ce7499 100644 --- a/tests/src/Simple/HelloWasm/Program.cs +++ b/tests/src/Simple/HelloWasm/Program.cs @@ -205,6 +205,8 @@ internal static class Program { PrintLine("Type casting with isinst & castclass to array test: Ok."); } + + ldindTest(); PrintLine("Done"); } @@ -305,6 +307,35 @@ internal static class Program PrintLine(intString); } + private unsafe static void ldindTest() + { + var ldindTarget = new TwoByteStr { first = byte.MaxValue, second = byte.MinValue }; + var ldindField = &ldindTarget.first; + if((*ldindField) == byte.MaxValue) + { + ldindTarget.second = byte.MaxValue; + *ldindField = byte.MinValue; + //ensure there isnt any overwrite of nearby fields + if(ldindTarget.first == byte.MinValue && ldindTarget.second == byte.MaxValue) + { + PrintLine("ldind test: Ok."); + } + else if(ldindTarget.first != byte.MinValue) + { + PrintLine("ldind test: Failed didnt update target."); + } + else + { + PrintLine("ldind test: Failed overwrote data"); + } + } + else + { + uint ldindFieldValue = *ldindField; + PrintLine("ldind test: Failed." + ldindFieldValue.ToString()); + } + } + [DllImport("*")] private static unsafe extern int printf(byte* str, byte* unused); } |