diff mbox

[PULL,v2,06/13] tcg: Work around clang bug wrt enum ranges

Message ID 1454976074-29220-2-git-send-email-rth@twiddle.net
State New
Headers show

Commit Message

Richard Henderson Feb. 9, 2016, 12:01 a.m. UTC
A subsequent patch patch will change the type of REG from int
to enum TCGReg, which provokes the following bug in clang:

  https://llvm.org/bugs/show_bug.cgi?id=16154

Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 tcg/tcg.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

Peter Maydell Feb. 9, 2016, 5:48 p.m. UTC | #1
On 9 February 2016 at 00:01, Richard Henderson <rth@twiddle.net> wrote:
> A subsequent patch patch will change the type of REG from int
> to enum TCGReg, which provokes the following bug in clang:
>
>   https://llvm.org/bugs/show_bug.cgi?id=16154
>
> Signed-off-by: Richard Henderson <rth@twiddle.net>
> ---
>  tcg/tcg.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)

It turns out there's another one of these at line 1610
in check_regs(), which I didn't notice in my pre-build
tests because that function is only used ifndef NDEBUG,
and my clang builds both happen to be non-debug builds.
It shows up in travis build logs though:
  https://travis-ci.org/qemu/qemu/jobs/108065058

thanks
-- PMM
diff mbox

Patch

diff --git a/tcg/tcg.c b/tcg/tcg.c
index 9a836c9..70c0cff 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -2059,9 +2059,9 @@  static void tcg_reg_alloc_op(TCGContext *s,
     } else {
         if (def->flags & TCG_OPF_CALL_CLOBBER) {
             /* XXX: permit generic clobber register list ? */ 
-            for(reg = 0; reg < TCG_TARGET_NB_REGS; reg++) {
-                if (tcg_regset_test_reg(tcg_target_call_clobber_regs, reg)) {
-                    tcg_reg_free(s, reg);
+            for (i = 0; i < TCG_TARGET_NB_REGS; i++) {
+                if (tcg_regset_test_reg(tcg_target_call_clobber_regs, i)) {
+                    tcg_reg_free(s, i);
                 }
             }
         }
@@ -2227,9 +2227,9 @@  static void tcg_reg_alloc_call(TCGContext *s, int nb_oargs, int nb_iargs,
     }
     
     /* clobber call registers */
-    for(reg = 0; reg < TCG_TARGET_NB_REGS; reg++) {
-        if (tcg_regset_test_reg(tcg_target_call_clobber_regs, reg)) {
-            tcg_reg_free(s, reg);
+    for (i = 0; i < TCG_TARGET_NB_REGS; i++) {
+        if (tcg_regset_test_reg(tcg_target_call_clobber_regs, i)) {
+            tcg_reg_free(s, i);
         }
     }