linbox
linbox copied to clipboard
Endianess-dependent code in LinBox::BlasMatrixApplyDomain
In linbox/blackbox/apply.h
, around line 629, there is the following code:
for (size_t j=0; j<_n; j++) {
// up to 53 bits will be ored-in, to be summed later
unsigned char* bitDest = combined;
bitDest += (size_t)rclen*((i % (size_t)rc)*_n+j);
long long mask = static_cast<long long>(ctd[j]);
bitDest += 2*i;
long long tmp;
memcpy(&tmp,bitDest,sizeof(long long));
tmp |= mask;
memcpy(bitDest,&tmp,sizeof(long long));
}
~~This code causes a crash (and hence a test suite failure) on 32 bit ARM where unaligned memory access is not supported. There may be additional places with this kind of code.~~ (the alignment issue has been fixed as of b79fb13) It'll also fail on big endian platforms such as PowerPC and S390x. Please decide if you want to support platforms that have big-endian orientation ~~or do not permit unaligned memory access~~ and if yes, fix the code so it works on them.