Skip to contentSkip to conversation

target/hppa: Free some temps in do_sub

PATCH In review Richard Henderson 3 participants 3 messages Jul 20, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target/hppa: Free some temps in do_sub

Two temps allocated but not freed. Do enough subtractions within a single TB and one can run out of temps entirely.

---
 target/hppa/translate.c | 2 ++
 1 file changed, 2 insertions(+)
target/hppa/translate.c +2 -0
index 52d7bea1ea..4bd22d4820 100644
@@ -1294,6 +1294,8 @@ static void do_sub(DisasContext *ctx, unsigned rt, TCGv_reg in1,
     save_or_nullify(ctx, cpu_psw_cb_msb, cb_msb);
     save_gpr(ctx, rt, dest);
     tcg_temp_free(dest);
+    tcg_temp_free(cb);
+    tcg_temp_free(cb_msb);
 
     /* Install the new nullification.  */
     cond_free(&ctx->null_cond);
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Richard Henderson

Two temps allocated but not freed. Do enough subtractions within a single TB and one can run out of temps entirely.

Fixes b2167459ae ("target-hppa: Implement basic arithmetic")
Quoted 2 lines
Quoted 18 lines
---
 target/hppa/translate.c | 2 ++
 1 file changed, 2 insertions(+)
target/hppa/translate.c +2 -0
index 52d7bea1ea..4bd22d4820 100644
@@ -1294,6 +1294,8 @@ static void do_sub(DisasContext *ctx, unsigned rt, TCGv_reg in1,
     save_or_nullify(ctx, cpu_psw_cb_msb, cb_msb);
     save_gpr(ctx, rt, dest);
     tcg_temp_free(dest);
+    tcg_temp_free(cb);
+    tcg_temp_free(cb_msb);
 
     /* Install the new nullification.  */
     cond_free(&ctx->null_cond);
Tested-by on v1 1/1
#2 lore raw
In reply to Richard Henderson

Hi,

Quoted 26 lines · Richard Henderson

Two temps allocated but not freed. Do enough subtractions within a single TB and one can run out of temps entirely.

---
 target/hppa/translate.c | 2 ++
 1 file changed, 2 insertions(+)
target/hppa/translate.c +2 -0
index 52d7bea1ea..4bd22d4820 100644
@@ -1294,6 +1294,8 @@ static void do_sub(DisasContext *ctx, unsigned rt, TCGv_reg in1,
     save_or_nullify(ctx, cpu_psw_cb_msb, cb_msb);
     save_gpr(ctx, rt, dest);
     tcg_temp_free(dest);
+    tcg_temp_free(cb);
+    tcg_temp_free(cb_msb);
 
     /* Install the new nullification.  */
     cond_free(&ctx->null_cond);
Signature · 1 line
2.25.1

Regards
Sven