[PATCH] Fix -Wshadow=local warnings and a minor bug in expr.c
Jeff Law
law@redhat.com
Fri Oct 4 14:51:00 GMT 2019
On 10/4/19 6:01 AM, Richard Sandiford wrote:
> Bernd Edlinger <bernd.edlinger@hotmail.de> writes:
>> @@ -4481,16 +4478,16 @@ emit_push_insn (rtx x, machine_mode mode, tree typ
>> /* Get the address of the stack space.
>> In this case, we do not deal with EXTRA separately.
>> A single stack adjust will do. */
>> - poly_int64 offset;
>> + poly_int64 offset1;
>> if (! args_addr)
>> {
>> temp = push_block (size, extra, where_pad == PAD_DOWNWARD);
>> extra = 0;
>> }
>> - else if (poly_int_rtx_p (args_so_far, &offset))
>> + else if (poly_int_rtx_p (args_so_far, &offset1))
>> temp = memory_address (BLKmode,
>> plus_constant (Pmode, args_addr,
>> - skip + offset));
>> + skip + offset1));
>
> How about "const_args_so_far" instead of "offset1"?
>
>> else
>> temp = memory_address (BLKmode,
>> plus_constant (Pmode,
>> @@ -4565,8 +4562,8 @@ emit_push_insn (rtx x, machine_mode mode, tree typ
>> {
>> /* Scalar partly in registers. This case is only supported
>> for fixed-wdth modes. */
>> - int size = GET_MODE_SIZE (mode).to_constant ();
>> - size /= UNITS_PER_WORD;
>> + int size1 = GET_MODE_SIZE (mode).to_constant ();
>> + size1 /= UNITS_PER_WORD;
>> int i;
>> int not_stack;
>> /* # bytes of start of argument
>> @@ -4613,7 +4610,7 @@ emit_push_insn (rtx x, machine_mode mode, tree typ
>> /* Loop over all the words allocated on the stack for this arg. */
>> /* We can do it by words, because any scalar bigger than a word
>> has a size a multiple of a word. */
>> - for (i = size - 1; i >= not_stack; i--)
>> + for (i = size1 - 1; i >= not_stack; i--)
>> if (i >= not_stack + offset)
>> if (!emit_push_insn (operand_subword_force (x, i, mode),
>> word_mode, NULL_TREE, NULL_RTX, align, 0, NULL_RTX,
>
> And "num_words" instead of "size1" here.
>
>> @@ -10200,9 +10192,9 @@ expand_expr_real_1 (tree exp, rtx target, machine_
>> GET_MODE_PRECISION (TYPE_MODE (type)), we need to extend from
>> the former to the latter according to the signedness of the
>> type. */
>> - scalar_int_mode mode = SCALAR_INT_TYPE_MODE (type);
>> + scalar_int_mode mode1 = SCALAR_INT_TYPE_MODE (type);
>> temp = immed_wide_int_const
>> - (wi::to_wide (exp, GET_MODE_PRECISION (mode)), mode);
>> + (wi::to_wide (exp, GET_MODE_PRECISION (mode1)), mode1);
>> return temp;
>> }
>>
>
> "mode1" -> "int_mode"
>
>> @@ -10583,14 +10575,14 @@ expand_expr_real_1 (tree exp, rtx target, machine_
>> if (tree_fits_uhwi_p (index1)
>> && compare_tree_int (index1, TREE_STRING_LENGTH (init)) < 0)
>> {
>> - tree type = TREE_TYPE (TREE_TYPE (init));
>> - scalar_int_mode mode;
>> + tree type1 = TREE_TYPE (TREE_TYPE (init));
>> + scalar_int_mode mode1;
>>
>> - if (is_int_mode (TYPE_MODE (type), &mode)
>> - && GET_MODE_SIZE (mode) == 1)
>> + if (is_int_mode (TYPE_MODE (type1), &mode1)
>> + && GET_MODE_SIZE (mode1) == 1)
>> return gen_int_mode (TREE_STRING_POINTER (init)
>> [TREE_INT_CST_LOW (index1)],
>> - mode);
>> + mode1);
>> }
>> }
>> }
>
> "type1" -> "char_type", "mode1" -> "char_mode"
>
>> @@ -12137,11 +12128,11 @@ do_store_flag (sepops ops, rtx target, machine_mod
>> && TREE_CODE (arg0) == SSA_NAME
>> && TREE_CODE (arg1) == INTEGER_CST)
>> {
>> - enum tree_code code = maybe_optimize_mod_cmp (ops->code, &arg0, &arg1);
>> - if (code != ops->code)
>> + enum tree_code code1 = maybe_optimize_mod_cmp (ops->code, &arg0, &arg1);
>> + if (code1 != ops->code)
>> {
>> struct separate_ops nops = *ops;
>> - nops.code = ops->code = code;
>> + nops.code = ops->code = code1;
>> nops.op0 = arg0;
>> nops.op1 = arg1;
>> nops.type = TREE_TYPE (arg0);
>
> Maybe "new_code" instead of "code1"?
>
> OK with those changes, thanks.
And I think in general we should look for better names than blindly
changing things to fooN and the like.
Jeff
More information about the Gcc-patches
mailing list