Skip to content

Commit

Permalink
erts: Strengthen literal tag assert
Browse files Browse the repository at this point in the history
We assert that if we are in a literal range, the literal tag
should also be set. This will only be true in the debug build,
but as asserts are only active in debug builds that is fine.
  • Loading branch information
garazdawi committed Jan 28, 2025
1 parent 0a9f526 commit 8324f3e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions erts/emulator/beam/global.h
Original file line number Diff line number Diff line change
Expand Up @@ -1564,6 +1564,9 @@ ERTS_GLB_FORCE_INLINE int erts_is_literal(Eterm tptr, Eterm *ptr)
ASSERT(ptr == ptr_val(tptr));

#if defined(ERTS_HAVE_IS_IN_LITERAL_RANGE)
#ifdef TAG_LITERAL_PTR
ASSERT(!erts_is_in_literal_range(ptr) || is_literal_ptr(tptr));
#endif
return erts_is_in_literal_range(ptr);
#elif defined(TAG_LITERAL_PTR)
return is_literal_ptr(tptr);
Expand Down

0 comments on commit 8324f3e

Please sign in to comment.