Hi, On 18/08/17 21:32, Jeremy Bicha wrote: > Source: drumgizmo > Version: 0.9.14-2 > Severity: serious > > drumgizmo fails to build from source on several release architectures > that it used to build on because of test failures. > > https://buildd.debian.org/status/package.php?p=drumgizmo
The attached patch does not fix all the test failures, but does fix the 3 affecting mips, and this should be enough to fix armel and mipsel as well. Things are still broken on mips64el and s390x after this. src/atomic.h: This fixes enginetest by removing the assertion. My guess is that the writer of the code meant to say "does this atomic use the std::atomic implementation" (as opposed to the other implementation in src/atomic.h) but instead said "is this atomic lock free" assuming that all std::atomics are always lock free... test/atomictest.cc: Fixes atomictest by removing the test for lock free atomics. One some architectures isLockFree may legitimately return false (eg it is impossible to make atomic<long int> lock free on 32-bit mips). The test was probably added with the same assumption as above. plugingui/image.cc: Fixes imagecachetest. The original code was not big-endian safe. Replace the memcpy with shifts and ORs. Thanks, James
--- a/src/atomic.h
+++ b/src/atomic.h
@@ -151,8 +151,6 @@ public:
SettingRef(Atomic<T>& value)
: value(value)
{
- // string isn't lock free either
- assert((std::is_same<T, std::string>::value || value.is_lock_free()));
}
bool hasChanged()
--- a/test/atomictest.cc
+++ b/test/atomictest.cc
@@ -40,7 +40,6 @@ class AtomicTest
CPPUNIT_TEST(nonPodAtomicCanBeValueInitialized);
CPPUNIT_TEST(podAtomicCanBeValueAssigned);
CPPUNIT_TEST(nonPodAtomicCanBeValueAssigned);
- CPPUNIT_TEST(podAtomicsAreLockFree);
CPPUNIT_TEST_SUITE_END();
public:
@@ -99,23 +98,6 @@ class AtomicTest
CPPUNIT_ASSERT_EQUAL(s.load(), std::string{"hello world"});
}
- void podAtomicsAreLockFree() {
- CPPUNIT_ASSERT(isLockFree<bool>());
- CPPUNIT_ASSERT(isLockFree<unsigned short int>());
- CPPUNIT_ASSERT(isLockFree<short int>());
- CPPUNIT_ASSERT(isLockFree<unsigned int>());
- CPPUNIT_ASSERT(isLockFree<int>());
- CPPUNIT_ASSERT(isLockFree<unsigned long int>());
- CPPUNIT_ASSERT(isLockFree<long int>());
- CPPUNIT_ASSERT(isLockFree<unsigned long long int>());
- CPPUNIT_ASSERT(isLockFree<long long int>());
- CPPUNIT_ASSERT(isLockFree<float>());
- CPPUNIT_ASSERT(isLockFree<double>());
-
- // compile error: undefined reference to `__atomic_is_lock_free'
- //CPPUNIT_ASSERT(isLockFree<long double>());
- }
-
// todo: further testing
private:
@@ -123,12 +105,6 @@ class AtomicTest
bool isUsingStandardImpl() {
return std::is_base_of<std::atomic<T>, Atomic<T>>::value;
}
-
- template <typename T>
- bool isLockFree() {
- Atomic<T> a;
- return a.is_lock_free();
- }
};
// Registers the fixture into the 'registry'
--- a/plugingui/image.cc
+++ b/plugingui/image.cc
@@ -86,10 +86,16 @@ void Image::setError()
std::uint32_t iw, ih;
- std::memcpy(&iw, ptr, sizeof(uint32_t));
+ iw = (uint32_t) ptr[0] |
+ (uint32_t) ptr[1] << 8 |
+ (uint32_t) ptr[2] << 16 |
+ (uint32_t) ptr[3] << 24;
ptr += sizeof(uint32_t);
- std::memcpy(&ih, ptr, sizeof(uint32_t));
+ ih = (uint32_t) ptr[0] |
+ (uint32_t) ptr[1] << 8 |
+ (uint32_t) ptr[2] << 16 |
+ (uint32_t) ptr[3] << 24;
ptr += sizeof(uint32_t);
_width = iw;
signature.asc
Description: OpenPGP digital signature

