-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
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
Build fails for linuxbsd x86_32 arch #87442
Comments
This is due to alignment requirements, does this actually happen without double precision? It shouldn't happen there arguably This is due to the change in CC @reduz |
I will test and try to compile x86_32 without double precision on a vanilla 4.x. |
Note that safe numerics with 64 bits are already used even in 32 bit builds and it's not necessarily safe without these guarantees, and this change arguably just exposed that factor, afaik |
Can you test this: diff --git a/core/templates/safe_refcount.h b/core/templates/safe_refcount.h
index 20fb0c6501..b39d8e2d98 100644
--- a/core/templates/safe_refcount.h
+++ b/core/templates/safe_refcount.h
@@ -60,7 +60,7 @@
static_assert(alignof(SafeFlag) == alignof(bool));
template <class T>
-class SafeNumeric {
+class alignas(alignof(T)) SafeNumeric {
std::atomic<T> value;
static_assert(std::atomic<T>::is_always_lock_free); or diff --git a/core/templates/safe_refcount.h b/core/templates/safe_refcount.h
index 20fb0c6501..d231b0308d 100644
--- a/core/templates/safe_refcount.h
+++ b/core/templates/safe_refcount.h
@@ -61,7 +61,7 @@
template <class T>
class SafeNumeric {
- std::atomic<T> value;
+ alignas(alignof(T)) std::atomic<T> value;
static_assert(std::atomic<T>::is_always_lock_free); And see if either solves it, the problem here is that |
I did not mean to be a part of this conversation, but since I'm here anyway, I can confirm the issue is still there, even with the |
Confirmed, the build fails on the official buildsystem. Full error message:
|
@AThousandShips Tested your diffs, they don't seem to work. It still raises the same error. |
Gotcha, they were based on the assumption that the atomic had a smaller alignment than the underlying type, didn't expect |
Tested versions
4.x at 0bcc0e9
(to be more prices - my 4.x fork at roalyr@647e40d)
System information
Linux mx-x230 5.10.0-27-amd64 #1 SMP Debian 5.10.205-2 (2023-12-31) x86_64 GNU/Linux
Issue description
Compilation fails with this error only for x86_32 (other architectures compile as intended):
Steps to reproduce
Compile source with these arguments:
Edit: same error without double precision.
Minimal reproduction project (MRP)
Not a project-related issue.
The text was updated successfully, but these errors were encountered: