symbol.c: fix pointer tagging for windows

SYMTBL_LITERAL_FLAG was defined as 1UL, which can be smaller
than uintptr_t on some platforms (e.g., Windows 64-bit). This
caused symtbl_get_ptr() to return a corrupted pointer.

Changed the flag to be explicitly cast to uintptr_t to ensure
correct behavior on all platforms.

Co-authored-by: Gemini <gemini@google.com>
This commit is contained in:
Yukihiro "Matz" Matsumoto
2025-08-21 10:04:18 +09:00
parent a8dbe48311
commit c5d8c7210d
+1 -1
View File
@@ -54,7 +54,7 @@ presym_sym2name(mrb_sym sym, mrb_int *lenp)
/* ------------------------------------------------------ */
/* LSB pointer tagging for literal flags */
#define SYMTBL_LITERAL_FLAG 1UL
#define SYMTBL_LITERAL_FLAG ((uintptr_t)1)
/* Extract clean pointer for memory operations */
static inline const char*