target/m68k: Fix build Werror with gcc 8.0.1
authorRichard Henderson <richard.henderson@linaro.org>
Tue, 8 May 2018 18:55:20 +0000 (11:55 -0700)
committerPeter Maydell <peter.maydell@linaro.org>
Fri, 11 May 2018 10:12:02 +0000 (11:12 +0100)
Fedora 28 ships with the released gcc 8.

The Werror stems from the compiler finding a path through the second
switch via a missing default case in which src1 is uninitialized, and
not being able to prove that the missing default case is unreachable
due to the first switch.

Simplify the second switch to merge default with OS_LONG,
which returns directly.  This removes the unreachable path.

Cc: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-id: 20180508185520.23757-1-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
target/m68k/translate.c

index e407ba2db336dd6ad657e2ed58164bcfe8ca1763..44a0ac4e2e92b5ffba1ad24471655d660b4aca45 100644 (file)
@@ -2297,7 +2297,7 @@ DISAS_INSN(arith_im)
         im = tcg_const_i32(read_im32(env, s));
         break;
     default:
-       abort();
+        g_assert_not_reached();
     }
 
     if (with_SR) {
@@ -2317,7 +2317,8 @@ DISAS_INSN(arith_im)
             }
             src1 = gen_get_sr(s);
             break;
-        case OS_LONG:
+        default:
+            /* OS_LONG; others already g_assert_not_reached.  */
             disas_undef(env, s, insn);
             return;
         }