diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3c41147be5f..3c7e29d2d7d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2018-04-25 Chung-Ju Wu + + * config/nds32/nds32.c (nds32_print_operand): Set op_value ealier. + 2018-04-25 Chung-Ju Wu * config/nds32/nds32.h (ASM_APP_ON): Add missing newline character. diff --git a/gcc/config/nds32/nds32.c b/gcc/config/nds32/nds32.c index 8994c13d7b0..da8af4c6f1a 100644 --- a/gcc/config/nds32/nds32.c +++ b/gcc/config/nds32/nds32.c @@ -2944,13 +2944,15 @@ nds32_asm_globalize_label (FILE *stream, const char *name) static void nds32_print_operand (FILE *stream, rtx x, int code) { + HOST_WIDE_INT op_value = 0; HOST_WIDE_INT one_position; HOST_WIDE_INT zero_position; bool pick_lsb_p = false; bool pick_msb_p = false; int regno; - int op_value; + if (CONST_INT_P (x)) + op_value = INTVAL (x); switch (code) { @@ -3003,7 +3005,6 @@ nds32_print_operand (FILE *stream, rtx x, int code) case 'V': /* 'x' is supposed to be CONST_INT, get the value. */ gcc_assert (CONST_INT_P (x)); - op_value = INTVAL (x); /* According to the Andes architecture, the system/user register index range is 0 ~ 1023.