Fix 32-bit build warnings with newer GCC on Ubuntu 25#14966
Open
vitahlin wants to merge 5 commits intoredis:unstablefrom
Open
Fix 32-bit build warnings with newer GCC on Ubuntu 25#14966vitahlin wants to merge 5 commits intoredis:unstablefrom
vitahlin wants to merge 5 commits intoredis:unstablefrom
Conversation
🤖 Augment PR SummarySummary: Fixes new GCC warnings seen on 32-bit Redis builds (Ubuntu 25 toolchain). Changes:
Technical Notes: The atomic alignment change impacts all 🤖 Was this summary useful? React with 👍 or 👎 |
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

This PR fixes several compiler warnings triggered by the newer GCC toolchain (Ubuntu 25 default) when building Redis on 32-bit systems.
Changed
1. Define unreachable only when not provided by the toolchain
Recent GCC versions and C23 may provide
unreachableas a built-in; unconditional redefinition can cause conflicts or build failures.2. Enforce 8-byte alignment for C11 _Atomic on 32-bit builds
64-bit atomic types (long long, uint64_t, time_t) on 32-bit architectures require strict 8-byte alignment to remain truly atomic and avoid alignment warnings/faults. A new redisAtomicAlign(n) macro is introduced to apply attribute((aligned(n))) only on 32-bit platforms, while redisAtomic remains a plain _Atomic qualifier. This avoids unnecessary padding and struct layout changes for smaller types (int, uint32_t) and on 64-bit systems where the compiler already provides correct natural alignment.
3. Use uintptr_t for pointer–integer conversions in module tests
Direct pointer/integer casts are size-sensitive across 32/64-bit targets and trigger stricter portability warnings.
CI result: https://github.com/vitahlin/redis/actions/runs/23744054245/job/69283039740
Note
Medium Risk
Touches low-level portability primitives (jemalloc
unreachable, C11 atomics alignment, and pointer/integer conversions), which could impact 32-bit correctness if misapplied, but the changes are small and largely mechanical.Overview
Improves 32-bit build portability with newer GCC/C23 by avoiding conflicts with toolchain-provided
unreachable(only defines jemalloc’sunreachable()if not already defined).Adjusts the C11 atomic path to force 8-byte alignment for
redisAtomicvariables, and updates several test modules to cast metadata pointers and timer callbackdatathroughuintptr_tbefore storing in/reading fromuint64_torvoid*, eliminating size-related warnings.Written by Cursor Bugbot for commit 75e2475. This will update automatically on new commits. Configure here.