Repository navigation
Closed
Description
/data/src/mimalloc/v2.1.1$ uname -a
Linux dev 5.15.49-linuxkit #1 SMP Tue Sep 13 07:51:46 UTC 2022 x86_64 GNU/Linux
/data/src/mimalloc/v2.1.1$ clang --version
Debian clang version 15.0.7
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
/usr/bin/clang++ -DMI_MALLOC_OVERRIDE -I/tmp/v2.1.1/include -O3 -DNDEBUG -fPIC -Wno-deprecated -Wall -Wextra -Wno-unknown-pragmas -fvisibility=hidden -Wpedantic -Wno-static-in-inline -ftls-model=initial-exec -fno-builtin-malloc -std=gnu++17 -MD -MT CMakeFiles/mimalloc-obj.dir/src/static.c.o -MF CMakeFiles/mimalloc-obj.dir/src/static.c.o.d -o CMakeFiles/mimalloc-obj.dir/src/static.c.o -c /tmp/v2.1.1/src/static.c
In file included from /tmp/v2.1.1/src/static.c:17:
In file included from /tmp/v2.1.1/include/mimalloc/internal.h:17:
In file included from /tmp/v2.1.1/include/mimalloc/types.h:24:
/tmp/v2.1.1/include/mimalloc/atomic.h:284:10: error: no matching function for call to 'atomic_compare_exchange_strong_explicit'
return mi_atomic_cas_strong_acq_rel(once, &expected, 1); // try to set to 1
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/v2.1.1/include/mimalloc/atomic.h:61:50: note: expanded from macro 'mi_atomic_cas_strong_acq_rel'
#define mi_atomic_cas_strong_acq_rel(p,exp,des) mi_atomic_cas_strong(p,exp,des,mi_memory_order(acq_rel),mi_memory_order(acquire))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/v2.1.1/include/mimalloc/atomic.h:50:3: note: expanded from macro 'mi_atomic_cas_strong'
mi_atomic(compare_exchange_strong_explicit)(p,expected,desired,mem_success,mem_fail)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/v2.1.1/include/mimalloc/atomic.h:24:33: note: expanded from macro 'mi_atomic'
#define mi_atomic(name) std::atomic_##name
^~~~~~~~~~~~~~~~~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/atomic:1123:5: note: candidate template ignored: deduced conflicting types for parameter '_ITp' ('unsigned long' vs. 'int')
atomic_compare_exchange_strong_explicit(atomic<_ITp>* __a,
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/atomic:1131:5: note: candidate template ignored: deduced conflicting types for parameter '_ITp' ('unsigned long' vs. 'int')
atomic_compare_exchange_strong_explicit(volatile atomic<_ITp>* __a,
^
Metadata
Metadata
Assignees
Labels
No labels
Activity
davide-digennaro-nozomi commentedon Apr 14, 2023
It appears that this particular standard library uses an improper function.
Instead of
it has
so you actually need to explicitly cast the third argument to make it work, e.g.:
fix build error on Android/Linux for an atomic signature (pr #724, is…
daanx commentedon Apr 14, 2023
Thanks so much for the report! I think it is fixed now.
davide-digennaro-nozomi commentedon Apr 17, 2023
please, note that the fix here may not be enough, as it depends on how precisely uintptr_t is defined (in fact, in some platforms it won't work at all, as it would require 1ULL, not 1UL).
the bulletproof fix is the one I mentioned above.
further fix for atomic build error suggested by Davide Di Gennaro (is…
daanx commentedon Apr 17, 2023
Thanks! I pushed a fix again :-)
further fix for atomic build error suggested by Davide Di Gennaro (is…