[PATCH] Fix -Wshadow=local warnings and a minor bug in expr.c

Bernd Edlinger bernd.edlinger@hotmail.de
Thu Oct 3 15:19:00 GMT 2019


Hi,

this fixes a few -Wshadow=local warnings in expr.c,
and a minor bug in expand_assignment.

The problem is the value if to_mode is usually GET_MODE (to_rtx),

            concat_store_slow:;
              rtx temp = assign_stack_temp (to_mode,
                                            GET_MODE_SIZE (GET_MODE (to_rtx)));

but it is GET_MODE_INNER (GET_MODE (to_rtx)) when this goto is taken:

              if (GET_CODE (result) == CONCAT)
                {
                  to_mode = GET_MODE_INNER (to_mode);
                  machine_mode from_mode = GET_MODE_INNER (GET_MODE (result));
                  rtx from_real
                    = simplify_gen_subreg (to_mode, XEXP (result, 0),
                                           from_mode, 0);
                  rtx from_imag
                    = simplify_gen_subreg (to_mode, XEXP (result, 1),
                                           from_mode, 0);
                  if (!from_real || !from_imag)
                    goto concat_store_slow;

I fixed that by simply using GET_MODE (to_rtx) in the assign_stack_temp,
so it does not matter what is in to_mode.  It is a minor bug, since
probably the inner mode of a complex will always have the same alignment
as the complex itself, but I have not checked that.


Bootstrapped and reg-tested on x86_64-pc-linux-gnu.
Is it OK for trunk?


Thanks
Bernd.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch-wshadow-expr.diff
Type: text/x-patch
Size: 11001 bytes
Desc: patch-wshadow-expr.diff
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20191003/2b67ee3c/attachment.bin>


More information about the Gcc-patches mailing list