Skip to contentSkip to conversation

target-alpha: fix uninitialized variable

PATCH Applied Paolo Bonzini 3 participants 5 messages Oct 19, 2015 – Nov 3, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target-alpha: fix uninitialized variable

I am not sure why the compiler does not catch it. There is no semantic change since gen_excp returns EXIT_NORETURN, but the old code is wrong.

Reported by Coverity.

---
 target-alpha/translate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target-alpha/translate.c +1 -1
index f936d1b..53f6833 100644
@@ -2916,7 +2916,7 @@ void gen_intermediate_code(CPUAlphaState *env, struct TranslationBlock *tb)
         num_insns++;
 
         if (unlikely(cpu_breakpoint_test(cs, ctx.pc, BP_ANY))) {
-            gen_excp(&ctx, EXCP_DEBUG, 0);
+            ret = gen_excp(&ctx, EXCP_DEBUG, 0);
             break;
         }
         if (num_insns == max_insns && (tb->cflags & CF_LAST_IO)) {
Signature · 1 line
2.5.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Paolo Bonzini

I am not sure why the compiler does not catch it. There is no semantic change since gen_excp returns EXIT_NORETURN, but the old code is wrong.

Reported by Coverity.

---
  target-alpha/translate.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

I assume this will go in via trivial.

r~

#2 lore raw
Quoted 7 lines · Richard Henderson
Quoted 6 lines · Paolo Bonzini

I am not sure why the compiler does not catch it. There is no semantic change since gen_excp returns EXIT_NORETURN, but the old code is wrong.

Reported by Coverity.

Quoted 8 lines
Quoted 4 lines
---
  target-alpha/translate.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

I assume this will go in via trivial.

Richard, after your patch 522a0d4e3c0d397ffb45ec400d8cbd426dad9d17 "target-*: Advance pc after recognizing a breakpoint", this code needs another review I think, as you modified the subsequent line ;) Please take a look.

Thanks,

/mjt

#3 lore raw
Quoted 13 lines · Michael Tokarev
Quoted 12 lines · Richard Henderson
Quoted 10 lines · Paolo Bonzini

I am not sure why the compiler does not catch it. There is no semantic change since gen_excp returns EXIT_NORETURN, but the old code is wrong.

Reported by Coverity.

---
  target-alpha/translate.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 8 lines
Quoted 3 lines

I assume this will go in via trivial.

Richard, after your patch 522a0d4e3c0d397ffb45ec400d8cbd426dad9d17 "target-*: Advance pc after recognizing a breakpoint", this code needs another review I think, as you modified the subsequent line ;) Please take a look.

It's okay, I noticed the conflict. Assigning the return value of gen_excp is still the right thing to do.

Paolo

#4 lore raw
In reply to Paolo Bonzini
Quoted 3 lines · Paolo Bonzini

I am not sure why the compiler does not catch it. There is no semantic change since gen_excp returns EXIT_NORETURN, but the old code is wrong.

Applied to -trivial. Indeed it's interesting why gcc can't catch it, might be due to unlikely() (which smells like a bug?)

Thanks,

/mjt