From 6a9e2b3cc381fd1b6c5ec5eddb077ea5468ef75e Mon Sep 17 00:00:00 2001 From: Alan Wu Date: Wed, 20 Oct 2021 19:04:22 -0400 Subject: YJIT: Show GCC that the mmap probing loop runs at least once Fixes: ./src/yjit_asm.c:196:8: warning: 'mem_block' may be used uninitialized [-Wmaybe-uninitialized] --- yjit_asm.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/yjit_asm.c b/yjit_asm.c index 5e433f5ea4..0d074d5e4d 100644 --- a/yjit_asm.c +++ b/yjit_asm.c @@ -158,8 +158,7 @@ uint8_t *alloc_exec_mem(uint32_t mem_size) uint32_t page_size = (uint32_t)sysconf(_SC_PAGESIZE); uint8_t *req_addr = align_ptr((uint8_t*)&alloc_exec_mem, page_size); - while (req_addr < (uint8_t*)&alloc_exec_mem + INT32_MAX) - { + do { // Try to map a chunk of memory as executable mem_block = (uint8_t*)mmap( (void*)req_addr, @@ -177,7 +176,7 @@ uint8_t *alloc_exec_mem(uint32_t mem_size) // +4MB req_addr += 4 * 1024 * 1024; - } + } while (req_addr < (uint8_t*)&alloc_exec_mem + INT32_MAX); // On MacOS and other platforms #else -- cgit v1.2.3