Bug#862090: mathicgb FTBFS on big endian architectures: test fails

2017-05-08 Thread Doug Torrance

Control: forwarded -1 https://github.com/Macaulay2/mathicgb/issues/3

On 05/08/2017 07:15 AM, Radovan Birdic wrote:

Package: mathicgb
Version: 1.0~git20170104-1
Severity: important
Tags: sid + patch
Justification: FTBFS
User: debian-m...@lists.debian.org
Usertags: mips-patch

Hello,

Package mathicgb_1.0~git20170104-1 FTBFS on mips and other big endian 
architectures with following error:


...
make  check-TESTS
make[2]: Entering directory '/«PKGBUILDDIR»'
make[3]: Entering directory '/«PKGBUILDDIR»'
FAIL: unittest

   mathicgb 1.0: ./test-suite.log


# TOTAL: 1
# PASS:  0
# SKIP:  0
# XFAIL: 0
# FAIL:  1
# XPASS: 0
# ERROR: 0

.. contents:: :depth: 2

FAIL: unittest
==
...


Full build log:
https://buildd.debian.org/status/fetch.php?pkg=mathicgb=mips=1.0~git20170104-1=1486639289=0

On upstream this issue is resolved with proposed commit:
https://github.com/Macaulay2/mathicgb/pull/9/commits/d8ae074c7f7655c3b85c2089cd7a05a98a70a46a

I have attached the patch.

With this patch package builds successfully on mips and mipsel.


Thanks for your report!

I've been aware of this for a while (I submitted the issue upstream back 
in 2015), but I suppose it's good to have it in the Debian BTS as well 
-- thanks!


Upstream rejected the proposed patch as-is [1], which is why I've 
avoided applying it to the Debian package.  However, I noticed that it 
has been applied to the Fedora package [2].


Perhaps I'll follow their lead and apply it to the Debian package as 
well for the time being.  However, I'll wait until after the Stretch freeze.


Doug

[1] https://github.com/Macaulay2/mathicgb/pull/9#issuecomment-281349279
[2] 
http://pkgs.fedoraproject.org/cgit/rpms/mathicgb.git/commit/?id=0377aa73d04051c7b7c24c7ce28a054c31e66f52




Bug#862090: mathicgb FTBFS on big endian architectures: test fails

2017-05-08 Thread Radovan Birdic
Package: mathicgb
Version: 1.0~git20170104-1
Severity: important
Tags: sid + patch
Justification: FTBFS
User: debian-m...@lists.debian.org
Usertags: mips-patch

Hello,

Package mathicgb_1.0~git20170104-1 FTBFS on mips and other big endian 
architectures with following error:

>...
> make  check-TESTS
> make[2]: Entering directory '/«PKGBUILDDIR»'
> make[3]: Entering directory '/«PKGBUILDDIR»'
> FAIL: unittest
> 
>mathicgb 1.0: ./test-suite.log
> 
> 
> # TOTAL: 1
> # PASS:  0
> # SKIP:  0
> # XFAIL: 0
> # FAIL:  1
> # XPASS: 0
> # ERROR: 0
> 
> .. contents:: :depth: 2
> 
> FAIL: unittest
> ==
> ...

Full build log:
https://buildd.debian.org/status/fetch.php?pkg=mathicgb=mips=1.0~git20170104-1=1486639289=0

On upstream this issue is resolved with proposed commit:
https://github.com/Macaulay2/mathicgb/pull/9/commits/d8ae074c7f7655c3b85c2089cd7a05a98a70a46a

I have attached the patch.

With this patch package builds successfully on mips and mipsel.


Regards,
Radovan--- mathicgb-1.0~git20170104.orig/src/mathicgb/MonoMonoid.hpp
+++ mathicgb-1.0~git20170104/src/mathicgb/MonoMonoid.hpp
@@ -582,13 +582,9 @@ public:
   MATHICGB_ASSERT(i == varCount() / 2 || access(a, i*2+1) >= 0);
   
   uint64 A, B, AB;
-  // We have to use std::memcpy here because just casting to a int64 breaks
-  // the strict aliasing rule which implies undefined behavior. Both MSVC and
-  // gcc don't actually call memcpy here. MSVC is a tiny bit slower for this
-  // code than for casting while GCC seems to be exactly the same speed.
-  std::memcpy(, ptr(a, i*2), 8);
-  std::memcpy(, ptr(b, i*2), 8);
-  std::memcpy(, ptr(ab, i*2), 8);
+  A = *ptr(a, i*2) | (((uint64)*ptr(a, i*2 + 1)) << 32);
+  B = *ptr(b, i*2) | (((uint64)*ptr(b, i*2 + 1)) << 32);
+  AB = *ptr(ab, i*2) | (((uint64)*ptr(ab, i*2 + 1)) << 32);
   orOfXor |= AB ^ (A + B);
 }
 MATHICGB_ASSERT((orOfXor == 0) == isProductOf(a, b, ab));
@@ -608,11 +604,11 @@ public:
 uint64 orOfXor = 0;
 for (VarIndex i = varCount() / 2; i != beforeEntriesIndexBegin(); --i) {
   uint64 A1, A2, B, A1B, A2B;
-  std::memcpy(, ptr(a1, i*2), 8);
-  std::memcpy(, ptr(a2, i*2), 8);
-  std::memcpy(, ptr(b, i*2), 8);
-  std::memcpy(, ptr(a1b, i*2), 8);
-  std::memcpy(, ptr(a2b, i*2), 8);
+  A1 = *ptr(a1, i*2) | (((uint64)*ptr(a1, i*2 + 1)) << 32);
+  A2 = *ptr(a2, i*2) | (((uint64)*ptr(a2, i*2 + 1)) << 32);
+  B = *ptr(b, i*2) | (((uint64)*ptr(b, i*2 + 1)) << 32);
+  A1B = *ptr(a1b, i*2) | (((uint64)*ptr(a1b, i*2 + 1)) << 32);
+  A2B = *ptr(a2b, i*2) | (((uint64)*ptr(a2b, i*2 + 1)) << 32);
   orOfXor |= (A1B ^ (A1 + B)) | (A2B ^ (A2 + B));
 }
 MATHICGB_ASSERT