Skip to content

Commit

Permalink
arm/translate-a64: mark path as unreachable to eliminate warning
Browse files Browse the repository at this point in the history
Fixes the following warning when compiling with gcc 5.4.0 with -O1
optimizations and --enable-debug:

target/arm/translate-a64.c: In function ‘aarch64_tr_translate_insn’:
target/arm/translate-a64.c:2361:8: error: ‘post_index’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
     if (!post_index) {
        ^
target/arm/translate-a64.c:2307:10: note: ‘post_index’ was declared here
     bool post_index;
          ^
target/arm/translate-a64.c:2386:8: error: ‘writeback’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
     if (writeback) {
        ^
target/arm/translate-a64.c:2308:10: note: ‘writeback’ was declared here
     bool writeback;
          ^

Note that idx comes from selecting 2 bits, and therefore its value
can be at most 3.

Signed-off-by: Emilio G. Cota <[email protected]>
Acked-by: Philippe Mathieu-Daudé <[email protected]>
Message-id: [email protected]
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
  • Loading branch information
cota authored and pm215 committed Nov 13, 2017
1 parent f291910 commit 5ca6627
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions target/arm/translate-a64.c
Original file line number Diff line number Diff line change
Expand Up @@ -2351,6 +2351,8 @@ static void disas_ldst_reg_imm9(DisasContext *s, uint32_t insn,
post_index = false;
writeback = true;
break;
default:
g_assert_not_reached();
}

if (rn == 31) {
Expand Down

0 comments on commit 5ca6627

Please sign in to comment.