Martin Sebor <mse...@gmail.com> writes:
> @@ -409,23 +412,33 @@ builtin_memref::set_base_and_offset (tree expr)
>    base = get_inner_reference (expr, &bitsize, &bitpos, &var_off,
>                             &mode, &sign, &reverse, &vol);
>  
> +  /* get_inner_reference is not expected to return null.  */
> +  gcc_assert (base != NULL);
> +
>    poly_int64 bytepos = exact_div (bitpos, BITS_PER_UNIT);
>  
> -  HOST_WIDE_INT const_off;
> -  if (!base || !bytepos.is_constant (&const_off))
> +  /* Convert the poly_int64 offset to to offset_int.  The offset
> +     should be constant but be prepared for it not to be just in
> +     case.  */

I know it's just repeating what I said in the other reply, but I think
we should drop this comment.  It doesn't add anything and it will quickly
become out of date once the frontend supports variable-length types.

> +  offset_int cstoff;
> +  if (bytepos.is_constant (&cstoff))

Also, same comment about this being less efficient than using the
natural type of HOST_WIDE_INT.  I think this and...

>      {
> -      base = get_base_address (TREE_OPERAND (expr, 0));
> -      return;
> +      offrange[0] += cstoff;
> +      offrange[1] += cstoff;
> +
> +      /* Besides the reference saved above, also stash the offset
> +      for validation.  */
> +      if (TREE_CODE (expr) == COMPONENT_REF)
> +     refoff = cstoff;
>      }
> +  else
> +    offrange[1] += maxobjsize;
>  
> -  offrange[0] += const_off;
> -  offrange[1] += const_off;
> -
>    if (var_off)
>      {
>        if (TREE_CODE (var_off) == INTEGER_CST)
>       {
> -       offset_int cstoff = wi::to_offset (var_off);
> +       cstoff = wi::to_offset (var_off);
>         offrange[0] += cstoff;
>         offrange[1] += cstoff;

...this are logically separate variables, so there's no need for
them to have the same type and name.

Richard

Reply via email to