From: Julian Seward Date: Wed, 28 Jul 2004 07:12:30 +0000 (+0000) Subject: Fix bug in allocation of vregs for 64-bit IRTemps. X-Git-Tag: svn/VALGRIND_3_0_1^2~1186 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=985a06f874c6ed4ddb9e95da2af172951ca414f4;p=thirdparty%2Fvalgrind.git Fix bug in allocation of vregs for 64-bit IRTemps. git-svn-id: svn://svn.valgrind.org/vex/trunk@148 --- diff --git a/VEX/priv/host-generic/reg_alloc.c b/VEX/priv/host-generic/reg_alloc.c index 903f876487..30158a08b1 100644 --- a/VEX/priv/host-generic/reg_alloc.c +++ b/VEX/priv/host-generic/reg_alloc.c @@ -320,8 +320,13 @@ HInstrArray* doRegisterAllocation ( if (!hregIsVirtual(vreg)) continue; k = hregNumber(vreg); - if (k < 0 || k >= n_vregs) + if (k < 0 || k >= n_vregs) { + vex_printf("\n"); + (*ppInstr)(instrs_in->arr[ii]); + vex_printf("\n"); + vex_printf("vreg %d, n_vregs %d\n", k, n_vregs); vpanic("doRegisterAllocation: out-of-range vreg"); + } /* Take the opportunity to note its regclass. We'll need that when allocating spill slots. */ diff --git a/VEX/priv/host-x86/isel.c b/VEX/priv/host-x86/isel.c index fe904f8144..50e7796dbf 100644 --- a/VEX/priv/host-x86/isel.c +++ b/VEX/priv/host-x86/isel.c @@ -1022,7 +1022,7 @@ HInstrArray* iselBB_X86 ( IRBB* bb, Addr64(*find_helper)(Char*) ) env->vregmap[i] = hreg; env->vregmapHI[i] = hregHI; } - env->vreg_ctr = env->n_vregmap; + env->vreg_ctr = j; /* Ok, finally we can iterate over the statements. */ for (stmt = bb->stmts; stmt; stmt=stmt->link)