On Tue, Aug 25, 2015 at 10:53:31AM -0400, Lennart Sorensen wrote:
> On Tue, Aug 25, 2015 at 10:09:58AM -0400, Lennart Sorensen wrote:
> > OK, I was just trying what README.md said to do when using the get
> > monolite option.
> > 
> > I also just noticed I hadn't installed all the dependancies listed on
> > http://www.mono-project.com/docs/compiling-mono/linux/ so I just did that,
> > maybe it will help.
> 
> No help.
> 
> I just did:
> 
> ./autogen.sh
> make
> 
> And got:

Applying the patch here helped a lot:

https://bugzilla.xamarin.com/show_bug.cgi?id=31779#c1

So this:

diff --git a/mono/metadata/decimal-ms.c b/mono/metadata/decimal-ms.c
index d52e8c7..7972cc0 100644
--- a/mono/metadata/decimal-ms.c
+++ b/mono/metadata/decimal-ms.c
@@ -57,6 +57,13 @@ static const uint32_t ten_to_ten_div_4 = 2500000000U;
 #define DECIMAL_HI32(dec)        ((dec).Hi32)
 #define DECIMAL_LO64_GET(dec)    ((dec).v.Lo64)
 #define DECIMAL_LO64_SET(dec,value)   {(dec).v.Lo64 = value; }
+#if G_BYTE_ORDER != G_LITTLE_ENDIAN
+# define DECIMAL_LO64_GET(dec)   (((uint64_t)((dec).v.v.Mid32) << 32) | 
(dec).v.v.Lo32)
+# define DECIMAL_LO64_SET(dec,value)   {(dec).v.v.Lo32 = (value); 
(dec).v.v.Mid32 = ((value) >> 32); }
+#else
+# define DECIMAL_LO64_GET(dec)    ((dec).v.Lo64)
+# define DECIMAL_LO64_SET(dec,value)   {(dec).v.Lo64 = value; }
+#endif
 
 #define DECIMAL_SETZERO(dec) {DECIMAL_LO32(dec) = 0; DECIMAL_MID32(dec) = 0; 
DECIMAL_HI32(dec) = 0; DECIMAL_SIGNSCALE(dec) = 0;}
 #define COPYDEC(dest, src) {DECIMAL_SIGNSCALE(dest) = DECIMAL_SIGNSCALE(src); 
DECIMAL_HI32(dest) = DECIMAL_HI32(src); \

The code was assuming little endian incorrectly, so the value ended
up being put in the high 32 bit rather than the low 32 bit, and hence
converting to int32 caused an overflow.

-- 
Len Sorensen

Reply via email to