From 9a90cd228466ec088d6f0da8d1aa065f03daa7c8 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Tue, 8 Oct 2024 15:41:28 +0900 Subject: Cast via `uintptr_t` function pointer between object pointer - ISO C forbids conversion of function pointer to object pointer type - ISO C forbids conversion of object pointer to function pointer type --- yjit.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'yjit.c') diff --git a/yjit.c b/yjit.c index dedd06dd2d..93d8fe5c9f 100644 --- a/yjit.c +++ b/yjit.c @@ -272,7 +272,7 @@ rb_yjit_reserve_addr_space(uint32_t mem_size) // On Linux #if defined(MAP_FIXED_NOREPLACE) && defined(_SC_PAGESIZE) uint32_t const page_size = (uint32_t)sysconf(_SC_PAGESIZE); - uint8_t *const cfunc_sample_addr = (void *)&rb_yjit_reserve_addr_space; + uint8_t *const cfunc_sample_addr = (void *)(uintptr_t)&rb_yjit_reserve_addr_space; uint8_t *const probe_region_end = cfunc_sample_addr + INT32_MAX; // Align the requested address to page size uint8_t *req_addr = align_ptr(cfunc_sample_addr, page_size); @@ -583,7 +583,7 @@ rb_get_mct_argc(const rb_method_cfunc_t *mct) void * rb_get_mct_func(const rb_method_cfunc_t *mct) { - return (void*)mct->func; // this field is defined as type VALUE (*func)(ANYARGS) + return (void*)(uintptr_t)mct->func; // this field is defined as type VALUE (*func)(ANYARGS) } const rb_iseq_t * @@ -1139,7 +1139,7 @@ rb_yjit_compile_iseq(const rb_iseq_t *iseq, rb_execution_context_t *ec, bool jit // Compile a block version starting at the current instruction uint8_t *rb_yjit_iseq_gen_entry_point(const rb_iseq_t *iseq, rb_execution_context_t *ec, bool jit_exception); // defined in Rust - uint8_t *code_ptr = rb_yjit_iseq_gen_entry_point(iseq, ec, jit_exception); + uintptr_t code_ptr = (uintptr_t)rb_yjit_iseq_gen_entry_point(iseq, ec, jit_exception); if (jit_exception) { iseq->body->jit_exception = (rb_jit_func_t)code_ptr; -- cgit v1.2.3