• Nathan Chancellor's avatar
    powerpc/xmon: Fix opcode being uninitialized in print_insn_powerpc · e7140639
    Nathan Chancellor authored
    When building with -Wsometimes-uninitialized, Clang warns:
    
      arch/powerpc/xmon/ppc-dis.c:157:7: warning: variable 'opcode' is used
      uninitialized whenever 'if' condition is false
      [-Wsometimes-uninitialized]
        if (cpu_has_feature(CPU_FTRS_POWER9))
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      arch/powerpc/xmon/ppc-dis.c:167:7: note: uninitialized use occurs here
        if (opcode == NULL)
            ^~~~~~
      arch/powerpc/xmon/ppc-dis.c:157:3: note: remove the 'if' if its
      condition is always true
        if (cpu_has_feature(CPU_FTRS_POWER9))
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      arch/powerpc/xmon/ppc-dis.c:132:38: note: initialize the variable
      'opcode' to silence this warning
        const struct powerpc_opcode *opcode;
                                           ^
                                            = NULL
      1 warning generated.
    
    This warning seems to make no sense on the surface because opcode is set
    to NULL right below this statement. Howev...
    e7140639
ppc-dis.c 8.68 KB