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&arch=mips&ver=1.0~git20170104-1&stamp=1486639289&raw=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(&A, ptr(a, i*2), 8);
- std::memcpy(&B, ptr(b, i*2), 8);
- std::memcpy(&AB, 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(&A1, ptr(a1, i*2), 8);
- std::memcpy(&A2, ptr(a2, i*2), 8);
- std::memcpy(&B, ptr(b, i*2), 8);
- std::memcpy(&A1B, ptr(a1b, i*2), 8);
- std::memcpy(&A2B, 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