You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With clang 18.1.3 (from LLVM-embedded-toolchain-for-Arm) the calloc function in picolibc (so that's __real_calloc) calls malloc, which then deadlocks because __wrap_malloc tries to lock the mutex already owned by __wrap_calloc:
NOTE 1: malloc+memset to replace calloc cannot be used because clang (and also gcc) will replace that code with a call to calloc.
NOTE 2: picolibc sources say malloc already 'sets to zero', but it's probably not smart to rely on that.
The text was updated successfully, but these errors were encountered:
Safest fix might be to change malloc_mutex into a recursive mutex. Then it will always just work, also if an unlikely future version of newlib changes its implementation. Otherwise something like this can be done:
With clang 18.1.3 (from LLVM-embedded-toolchain-for-Arm) the
calloc
function in picolibc (so that's__real_calloc
) callsmalloc
, which then deadlocks because__wrap_malloc
tries to lock the mutex already owned by__wrap_calloc
:My work-around is to replace
__wrap_calloc
's implementation with a call to__wrap_malloc
and then amemset
:NOTE 1:
malloc
+memset
to replacecalloc
cannot be used because clang (and also gcc) will replace that code with a call tocalloc
.NOTE 2: picolibc sources say
malloc
already 'sets to zero', but it's probably not smart to rely on that.The text was updated successfully, but these errors were encountered: