microsoft / microsoft/mimalloc
NDK compilation with x86 ABI report warning: [-Watomic-alignment]
- Dominant language
- C
- Stars
- 13.4k
- Forks
- 1.2k
- Avg merge
- 4d 45m
- Merged PRs (30d)
- 13
Description
Warning details:
```
[arm64-v8a] Compile : mimalloc_a <= static.c
[arm64-v8a] StaticLibrary : libmimalloc.a
[x86_64] Compile : mimalloc_a <= static.c
[x86_64] StaticLibrary : libmimalloc.a
[armeabi-v7a] Compile thumb : mimalloc_a <= static.c
[armeabi-v7a] StaticLibrary : libmimalloc.a
[x86] Compile : mimalloc_a <= static.c
In file included from ././src/static.c:23:
././src/stats.c:505:30: warning: misaligned atomic operation may incur significant performance penalty [-Watomic-alignment]
*peak_commit = (size_t)(mi_atomic_loadi64_relaxed((_Atomic(int64_t)*)&_mi_stats_main.committed.peak));
^
./include/mimalloc-atomic.h:111:41: note: expanded from macro 'mi_atomic_loadi64_relaxed'
#define mi_atomic_loadi64_relaxed(p) mi_atomic(load_explicit)(p,mi_memory_order(relaxed))
^
./include/mimalloc-atomic.h:35:33: note: expanded from macro 'mi_atomic'
#define mi_atomic(name) atomic_##name
^
:85:1: note: expanded from here
atomic_load_explicit
^
/opt/android-ndk/android-ndk-r20/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/8.0.7/include/stdatomic.h:325:2: note: expanded from macro 'atomic_load_explicit'
__c11_atomic_load(object, order)
^
In file included from ././src/static.c:23:
././src/stats.c:506:30: warning: misaligned atomic operation may incur significant performance penalty [-Watomic-alignment]
*current_commit = (size_t)(mi_atomic_loadi64_relaxed((_Atomic(int64_t)*)&_mi_stats_main.committed.current));
^
./include/mimalloc-atomic.h:111:41: note: expanded from macro 'mi_atomic_loadi64_relaxed'
#define mi_atomic_loadi64_relaxed(p) mi_atomic(load_explicit)(p,mi_memory_order(relaxed))
^
./include/mimalloc-atomic.h:35:33: note: expanded from macro 'mi_atomic'
#define mi_atomic(name) atomic_##name
^
:87:1: note: expanded from here
atomic_load_explicit
^
/opt/android-ndk/android-ndk-r20/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/8.0.7/include/stdatomic.h:325:2: note: expanded from macro 'atomic_load_explicit'
__c11_atomic_load(object, order)
^
2 warnings generated.
[x86] StaticLibrary : libmimalloc.a
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the Android NDK r20 x86 build and inspect src/stats.c lines 505-506 together with include/mimalloc-atomic.h, where the atomic loads are expanded. Confirm the warning's cause and verify that the x86 build completes without the atomic-alignment warnings while preserving the other ABI builds.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, c
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100