Skip to content

Commit 90645ff

Browse files
committed
Fix _Atomic compound assignment type error on clang
Clang considers the result type of `E1 op= E2` on _Atomic(size_t) to remain _Atomic(size_t), which cannot implicitly initialize a plain size_t. Add an explicit cast. https://claude.ai/code/session_016WrrtwsGrysn69mESb975G
1 parent c2dbfb9 commit 90645ff

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/libAtomVM/resources.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ void resource_type_fire_monitor(struct ResourceType *resource_type, ErlNifEnv *e
454454
// Balance the increment from enif_monitor_process.
455455
// Capture the return value of the atomic RMW directly; a separate
456456
// load would race with concurrent decrements.
457-
size_t val = (refc->ref_count -= REFC_MONITOR_INC);
457+
size_t val = (size_t) (refc->ref_count -= REFC_MONITOR_INC);
458458
if ((val & REFC_DYING_FLAG) && !(val & REFC_MONITOR_MASK)) {
459459
resource_unmark_serialized(refc->data, refc->resource_type);
460460
synclist_remove(&env->global->refc_binaries, &refc->head);

0 commit comments

Comments
 (0)