Run the following code on x86 Mono, e.g. on Android: ```csharp float resultF = Add(1.0f, 2.0f); double resultD = Add(1.0, 2.0); Console.WriteLine(resultF); Console.WriteLine(resultD); static T Add<T>(T left, T right) where T : struct { unchecked { if (left is short) return (T)(ValueType)(short) ( (short) (ValueType)left + (short) (ValueType)right ); else if (left is int) return (T)(ValueType)(int) ( (int) (ValueType)left + (int) (ValueType)right ); else if (left is long) return (T)(ValueType)(long) ( (long) (ValueType)left + (long) (ValueType)right ); else if (left is ushort) return (T)(ValueType)(ushort) ( (ushort)(ValueType)left + (ushort)(ValueType)right ); else if (left is uint) return (T)(ValueType)(uint) ( (uint) (ValueType)left + (uint) (ValueType)right ); else if (left is ulong) return (T)(ValueType)(ulong) ( (ulong) (ValueType)left + (ulong) (ValueType)right ); else if (left is byte) return (T)(ValueType)(byte) ( (byte) (ValueType)left + (byte) (ValueType)right ); else if (left is sbyte) return (T)(ValueType)(sbyte) ( (sbyte) (ValueType)left + (sbyte) (ValueType)right ); else if (left is float) return (T)(ValueType)(float) ( (float) (ValueType)left + (float) (ValueType)right ); else if (left is double) return (T)(ValueType)(double) ( (double)(ValueType)left + (double)(ValueType)right ); else throw new NotImplementedException(); } } ``` It crashes with this runtime assert: ``` * Assertion at /Users/alexander/dev/runtime/src/mono/mono/mini/mini-codegen.c:2306, condition `sp < 8' not met ``` I saw that x86 is the only platform where we define `MONO_ARCH_USE_FPSTACK` to true, that's why we only see it there.
Activity
akoeplinger commentedon Oct 13, 2021
/cc @vargaz
Disable tests that fail on x86 due to a Mono runtime asserts
Fix System.Numerics.Vectors tests on iOS and other FullAOT targets (#…
vargaz commentedon Aug 9, 2022
Should be fixed by
#65723
akoeplinger commentedon Aug 10, 2022
Confirmed it is fixed in Android x86