From 5784714f734caf3713ff880ffe100bbbec59216e Mon Sep 17 00:00:00 2001 From: Alessandro Gatti Date: Mon, 18 Nov 2024 22:00:31 +0100 Subject: [PATCH] shared/runtime/gchelper_generic: Fix AArch32 build on Clang. This commit fixes a compile error happening on Clang when building the generic gchelper code for AArch32. Clang would raise a warning regarding undefined variable access when aliasing a variable to an existing CPU register. The fix is pretty crude but it works - it simply disables the warning in question for the AArch32 gchelper collection function. Care was taken to make sure the code would also compile on GCC without warnings of sorts. Signed-off-by: Alessandro Gatti --- shared/runtime/gchelper_generic.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/shared/runtime/gchelper_generic.c b/shared/runtime/gchelper_generic.c index 0937231374..45b2e4f7d8 100644 --- a/shared/runtime/gchelper_generic.c +++ b/shared/runtime/gchelper_generic.c @@ -101,6 +101,10 @@ static void gc_helper_get_regs(gc_helper_regs_t arr) { // Fallback implementation, prefer gchelper_thumb1.s or gchelper_thumb2.s static void gc_helper_get_regs(gc_helper_regs_t arr) { + #ifdef __clang__ + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wuninitialized" + #endif register long r4 asm ("r4"); register long r5 asm ("r5"); register long r6 asm ("r6"); @@ -121,6 +125,9 @@ static void gc_helper_get_regs(gc_helper_regs_t arr) { arr[7] = r11; arr[8] = r12; arr[9] = r13; + #ifdef __clang__ + #pragma clang diagnostic pop + #endif } #elif defined(__aarch64__)