Run the following code on an arm64 machine (e.g. Apple-M1):
using System.Runtime.CompilerServices;
long[] a = new long[100];
ref long misalignedLong = ref Unsafe.As<byte, long>(
ref Unsafe.Add(ref Unsafe.As<long, byte>(ref a[0]), 1));
Test(ref misalignedLong);
[MethodImpl(MethodImplOptions.NoInlining)]
long Test(ref long misalignedLong) => Volatile.Read(ref misalignedLong);
Expected:
No exception or DataMisalignedException is thrown
Actual:
Run the following code on an arm64 machine (e.g. Apple-M1):
Expected:
Actual: