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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot 
gnu.org
   Last reconfirmed|                            |2022-06-15
           Priority|P3                          |P2
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |ASSIGNED
           Keywords|needs-bisection             |

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.

#1  0x0000000002d39e66 in bitmap_check_index (map=0x44062b0, index=-1)
    at /space/rguenther/src/gcc/gcc/sbitmap.h:104
104       gcc_checking_assert (index >= 0);

get_byte_range returns true but a size of zero, it seems to be constrainted
on "COPY inside REF" but we have

(gdb) p *use_ref
$3 = {ref = <realpart_expr 0x7ffff6a0f920>, 
  base = <function_decl 0x7ffff6a00200 a>, 
  offset = {<poly_int_pod<1, long>> = {coeffs = {0}}, <No data fields>}, 
  size = {<poly_int_pod<1, long>> = {coeffs = {32}}, <No data fields>}, 
  max_size = {<poly_int_pod<1, long>> = {coeffs = {32}}, <No data fields>}, 
  ref_alias_set = -1, base_alias_set = -1, volatile_p = false}
(gdb) p *ref
$4 = {ref = <imagpart_expr 0x7ffff6a0f9a0>, 
  base = <function_decl 0x7ffff6a00200 a>, 
  offset = {<poly_int_pod<1, long>> = {coeffs = {32}}, <No data fields>}, 
  size = {<poly_int_pod<1, long>> = {coeffs = {32}}, <No data fields>}, 
  max_size = {<poly_int_pod<1, long>> = {coeffs = {32}}, <No data fields>}, 
  ref_alias_set = -1, base_alias_set = -1, volatile_p = false}

which means the refs do not overlap.  We have

(gdb) p debug_gimple_stmt (use_stmt)
# VUSE <.MEM_16>
_2 = REALPART_EXPR <MEM[(complex float *)a]>;
$5 = void
(gdb) p debug_gimple_stmt (stmt)
# .MEM_21 = VDEF <.MEM_18>
IMAGPART_EXPR <MEM[(complex float *)a]> = _5;

so we expected ref_maybe_used_by_stmt_p to return false but it does not
(because we reference a FUNCTION_DECL).   That's because of

  /* We can end up referring to code via function and label decls.
     As we likely do not properly track code aliases conservatively
     bail out.  */
  if (TREE_CODE (base1) == FUNCTION_DECL
      || TREE_CODE (base1) == LABEL_DECL
      || TREE_CODE (base2) == FUNCTION_DECL
      || TREE_CODE (base2) == LABEL_DECL)
    return true;

we can make this less restrictive for the case of two decls which is also
the case DSE is interested in here.

Reply via email to