Skip to content

Commit 5784714

Browse files
agattidpgeorge
authored andcommitted
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 <[email protected]>
1 parent 0f7d680 commit 5784714

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

shared/runtime/gchelper_generic.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ static void gc_helper_get_regs(gc_helper_regs_t arr) {
101101
// Fallback implementation, prefer gchelper_thumb1.s or gchelper_thumb2.s
102102

103103
static void gc_helper_get_regs(gc_helper_regs_t arr) {
104+
#ifdef __clang__
105+
#pragma clang diagnostic push
106+
#pragma clang diagnostic ignored "-Wuninitialized"
107+
#endif
104108
register long r4 asm ("r4");
105109
register long r5 asm ("r5");
106110
register long r6 asm ("r6");
@@ -121,6 +125,9 @@ static void gc_helper_get_regs(gc_helper_regs_t arr) {
121125
arr[7] = r11;
122126
arr[8] = r12;
123127
arr[9] = r13;
128+
#ifdef __clang__
129+
#pragma clang diagnostic pop
130+
#endif
124131
}
125132

126133
#elif defined(__aarch64__)

0 commit comments

Comments
 (0)