Skip to content

Fix term asserts #1717

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/libAtomVM/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -961,7 +961,7 @@ void memory_sweep_mso_list(term mso_list, GlobalContext *global, bool from_task)
while (l != term_nil()) {
term h = term_get_list_head(l);
// the mso list only contains boxed values; each refc is unique
TERM_DEBUG_ASSERT(term_is_boxed(h))
TERM_DEBUG_ASSERT(term_is_boxed(h));
term *boxed_value = term_to_term_ptr(h);
if (memory_is_moved_marker(boxed_value)) {
h = memory_dereference_moved_marker(boxed_value);
Expand Down
4 changes: 2 additions & 2 deletions src/libAtomVM/term.h
Original file line number Diff line number Diff line change
Expand Up @@ -1683,7 +1683,7 @@ static inline void term_put_tuple_element(term t, uint32_t elem_index, term put_

term *boxed_value = term_to_term_ptr(t);

TERM_DEBUG_ASSERT(((boxed_value[0] & TERM_BOXED_TAG_MASK) == 0) && (elem_index < (boxed_value[0] >> 6)));
TERM_DEBUG_ASSERT((size_t) elem_index < term_get_size_from_boxed_header(boxed_value[0]));

boxed_value[elem_index + 1] = put_value;
}
Expand All @@ -1702,7 +1702,7 @@ static inline term term_get_tuple_element(term t, int elem_index)

const term *boxed_value = term_to_const_term_ptr(t);

TERM_DEBUG_ASSERT(((boxed_value[0] & TERM_BOXED_TAG_MASK) == 0) && (elem_index < (boxed_value[0] >> 6)));
TERM_DEBUG_ASSERT((size_t) elem_index < term_get_size_from_boxed_header(boxed_value[0]));

return boxed_value[elem_index + 1];
}
Expand Down
Loading