Skip to content

Commit

Permalink
Suppress -Wsign-compare warning
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu committed Mar 23, 2023
1 parent 310af50 commit b738cb0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion vm_backtrace.c
Expand Up @@ -57,8 +57,11 @@ calc_pos(const rb_iseq_t *iseq, const VALUE *pc, int *lineno, int *node_id)
VM_ASSERT(ISEQ_BODY(iseq)->iseq_size);

ptrdiff_t n = pc - ISEQ_BODY(iseq)->iseq_encoded;
VM_ASSERT(n <= ISEQ_BODY(iseq)->iseq_size);
VM_ASSERT(n >= 0);
#if SIZEOF_PTRDIFF_T > SIZEOF_INT
VM_ASSERT(n <= (ptrdiff_t)UINT_MAX);
#endif
VM_ASSERT((unsigned int)n <= ISEQ_BODY(iseq)->iseq_size);
ASSUME(n >= 0);
size_t pos = n; /* no overflow */
if (LIKELY(pos)) {
Expand Down

0 comments on commit b738cb0

Please sign in to comment.