mono: result of regmask should be stored in regmask_t, not int (#41543)
authormonojenkins <jo.shields+jenkins@xamarin.com>
Mon, 31 Aug 2020 13:12:59 +0000 (09:12 -0400)
committerGitHub <noreply@github.com>
Mon, 31 Aug 2020 13:12:59 +0000 (15:12 +0200)
While unlikely in practice, architectures with more than 32 registers would be affected by this as `sizeof(regmask_t) ==8` && `sizeof(int) == 4`.

Run into this while debugging something unrelated.

Co-authored-by: skmp <skmp@users.noreply.github.com>
src/mono/mono/mini/mini-codegen.c

index 9fdf040..1894c65 100644 (file)
@@ -1744,7 +1744,8 @@ mono_local_regalloc (MonoCompile *cfg, MonoBasicBlock *bb)
                }
 
                if (spec [MONO_INST_CLOB] == 'c') {
-                       int j, s, dreg, dreg2, cur_bank;
+                       int j, dreg, dreg2, cur_bank;
+                       regmask_t s;
                        guint64 clob_mask;
 
                        clob_mask = MONO_ARCH_CALLEE_REGS;