diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2023-03-23 21:51:18 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2023-03-23 23:31:46 +0900 |
commit | b738cb01b66c7b80364f9044b64097d690e49fc7 (patch) | |
tree | 73ca8265509116dd8d0a5636fbeed78aac8cbfdc | |
parent | 310af50c3b320f7dac7c6b1e165f29c7a3d5db4b (diff) | |
download | ruby-b738cb01b66c7b80364f9044b64097d690e49fc7.tar.gz |
Suppress -Wsign-compare warning
-rw-r--r-- | vm_backtrace.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/vm_backtrace.c b/vm_backtrace.c index 6264082a3f..9a041c4c2c 100644 --- a/vm_backtrace.c +++ b/vm_backtrace.c @@ -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)) { |