https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84526

--- Comment #7 from Martin Sebor <msebor at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #5)
> 
> What is the TREE_OPERAND (expr, 0) in:
>   base = get_inner_reference (expr, &bitsize, &bitpos, &var_off,
>                               &mode, &sign, &reverse, &vol);
>      
>   poly_int64 bytepos = exact_div (bitpos, BITS_PER_UNIT);
>                   
>   HOST_WIDE_INT const_off;
>   if (!base || !bytepos.is_constant (&const_off))
>     {
>       base = get_base_address (TREE_OPERAND (expr, 0));
>       return;
>     }
> doing?  It doesn't seem you've checked what expr actually is before using
> TREE_OPERAND (expr, 0) on it.  The cases that fall through into this code are
> either that expr is an operand of ADDR_EXPR, or SSA_NAME, or in theory some
> constant.  I don't think get_inner_reference ever returns NULL though.

This bit was left over from the previous version that used
get_addr_base_and_unit_offset() where the function can return null.  If
get_inner_reference() cannot return null and if the byte offset is guaranteed
to be constant the code can be removed.  (I made the change based on your
suggestion in bug 84095 and asked you to review it multiple times before I
committed it.)

Reply via email to