[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Potential Mono removal from 32-bit big endian PowerPC in next upload



On Wed, Aug 26, 2015 at 10:45:24AM -0400, Lennart Sorensen wrote:
> On Tue, Aug 25, 2015 at 05:54:10PM -0400, Lennart Sorensen wrote:
> > On Tue, Aug 25, 2015 at 10:30:45PM +0100, Jo Shields wrote:
> > > On 25/08/15 22:29, Lennart Sorensen wrote:
> > > > I had thought that could be it too. I certainly haven't seen that
> > > > particular problem so far. Are you simply running make or are you
> > > > passing any arguments to configure or anything? I tried using a copy
> > > > of the debian dir from the mono package in experimental since I
> > > > figured that had to be close to what this tree is based on, but
> > > > running debian/rules build failed (I forget in what way, but it
> > > > failed). Just running make seems fine though.
> > > 
> > > Just ./autogen.sh, make get-monolite-latest, make
> > 
> > Well I am running that in a fresh git clone just to be sure.
> > 
> > In case it helps, here is the list of pacakges and versions in my sid chroot:
> 
> By the way, one of the tests that fails is this:
> 
> Test Case Failures:
> 1) MonoTests.Microsoft.Build.BuildEngine.Various.Properties.AllowedFrameworkMembers :   #4
>   Expected string length 1 but was 21. Strings differ at index 0.
>   Expected: "3"
>   But was:  "1.04346664401671E-320"
>   -----------^
> 
> Now it happens that as a double, 3 is:
> 0x40 08 00 00 00 00 00 00
> 
> and 1.04346664401671E-320 is:
> 0x00 00 00 00 00 00 08 40
> 
> So yet another obvious endianess bug.

And a patch that fixes that (since the double's stored in the table are
little endian, they have to be endian swapped before being returned as
a double).

diff --git a/mscorlib/system/globalization/charunicodeinfo.cs b/mscorlib/system/globalization/charunicodeinfo.cs
index 22a4a01..c8e2ce1 100644
--- a/mscorlib/system/globalization/charunicodeinfo.cs
+++ b/mscorlib/system/globalization/charunicodeinfo.cs
@@ -157,6 +157,22 @@ namespace System.Globalization {
                 return(value);
         }
 
+        unsafe private static double EndianSwap(double value)
+        {
+            if (!BitConverter.IsLittleEndian) {
+                byte *ptr = (byte *) &value;
+                double res;
+                byte *buf = (byte *) &res;
+                ushort t = sizeof(double) - 1;
+
+                for (ushort i = 0; i < sizeof(double); i++)
+                    buf[t-i] = ptr[i];
+
+                return(res);
+            } else
+                return(value);
+        }
+
 
         //We need to allocate the underlying table that provides us with the information that we
         //use.  We allocate this once in the class initializer and then we don't need to worry
@@ -322,7 +338,7 @@ namespace System.Globalization {
             }
             return (((double*)s_pNumericValues)[pBytePtr[(ch & 0x000f)]]);
 #else
-            return (((double*)s_pNumericValues)[pBytePtr[(ch & 0x000f)]]);
+            return EndianSwap(((double*)s_pNumericValues)[pBytePtr[(ch & 0x000f)]]);
 #endif
         }


Now investigating:

Test Case Failures:
1) MonoTests.Microsoft.Build.Tasks.CopyTest.TestCopy_OverwriteReadOnlyFalse :   A1
  Expected: ReadOnly
  But was:  Normal

at MonoTests.Microsoft.Build.Tasks.CopyTest.TestCopy_OverwriteReadOnlyFalse () [0x00061] in /tmp/mono-new/mono-1/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/CopyTest.cs:367
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00054] in /tmp/mono-new/mono-1/mcs/class/corlib/System.Reflection/MonoMethod.cs:230

2) MonoTests.Microsoft.Build.Tasks.CopyTest.TestCopy_OverwriteReadOnlyTrue :   A1
  Expected: ReadOnly
  But was:  Normal

at MonoTests.Microsoft.Build.Tasks.CopyTest.TestCopy_OverwriteReadOnlyTrue () [0x00061] in /tmp/mono-new/mono-1/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/CopyTest.cs:319
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00054] in /tmp/mono-new/mono-1/mcs/class/corlib/System.Reflection/MonoMethod.cs:230

3) MonoTests.Microsoft.Build.Tasks.CopyTest.TestCopy_Retries :   A1
  Expected: ReadOnly
  But was:  Normal

at MonoTests.Microsoft.Build.Tasks.CopyTest.TestCopy_Retries () [0x00076] in /tmp/mono-new/mono-1/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/CopyTest.cs:412
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00054] in /tmp/mono-new/mono-1/mcs/class/corlib/System.Reflection/MonoMethod.cs:230

-- 
Len Sorensen


Reply to: