Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Endianess-dependent code in LinBox::BlasMatrixApplyDomain #297

Open
clausecker opened this issue Jul 28, 2022 · 0 comments
Open

Endianess-dependent code in LinBox::BlasMatrixApplyDomain #297

clausecker opened this issue Jul 28, 2022 · 0 comments

Comments

@clausecker
Copy link

clausecker commented Jul 28, 2022

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.

@clausecker clausecker changed the title Unaligned memory access in LinBox::BlasMatrixApplyDomain Endianess-dependent code in LinBox::BlasMatrixApplyDomain Jul 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant