Multi-register location descriptors in dwarf2out.c

Richard Sandiford richard.sandiford@linaro.org
Wed Jul 20 12:37:00 GMT 2011


dwarf2out.c:multiple_reg_loc_descriptor has the code:

  size = GET_MODE_SIZE (GET_MODE (XVECEXP (regs, 0, 0)));
  loc_result = NULL;

  for (i = 0; i < XVECLEN (regs, 0); ++i)
    {
      dw_loc_descr_ref t;

      t = one_reg_loc_descriptor (REGNO (XVECEXP (regs, 0, i)),
				  VAR_INIT_STATUS_INITIALIZED);
      add_loc_descr (&loc_result, t);
      size = GET_MODE_SIZE (GET_MODE (XVECEXP (regs, 0, 0)));
      add_loc_descr_op_piece (&loc_result, size);
    }

  if (loc_result && initialized == VAR_INIT_STATUS_UNINITIALIZED)
    add_loc_descr (&loc_result, new_loc_descr (DW_OP_GNU_uninit, 0, 0));
  return loc_result;

The "loc_result &&" check makes it seem as though we're trying to cope
with cases XVECLEN is zero, but that only works if the first (dead) load
of XEXVECP (regs, 0, 0) is optimised away.  Is a length of 0 valid
in this context?  If not, should we assert for it?

Also, is the size assignment in the loop supposed to always read
element 0, or is it a typo for XVECEXP (regs, 0, i)?

Richard



More information about the Gcc mailing list