When allocating new temps during tcg_optmize, do not re-use any EBB temps that were used within the TB. We do not have any idea what span of the TB in which the temp was live.
Cc: qemu-sta...@nongnu.org Fixes: fb04ab7ddd8 ("tcg/optimize: Lower TCG_COND_TST{EQ,NE} if unsupported") Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2711 Reported-by: wannacu <wannacu2...@gmail.com> Signed-off-by: Richard Henderson <richard.hender...@linaro.org> --- Unless there's some other reason to spin an -rc4, this can wait to be the first patch for 10.0.1. r~ --- tcg/tcg.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tcg/tcg.c b/tcg/tcg.c index 0babae1b88..eece825e2e 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -6120,6 +6120,9 @@ int tcg_gen_code(TCGContext *s, TranslationBlock *tb, uint64_t pc_start) } #endif + /* Do not reuse any EBB that may be allocated within the TB. */ + memset(s->free_temps, 0, sizeof(s->free_temps)); + tcg_optimize(s); reachable_code_pass(s); -- 2.43.0