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

--- Comment #6 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
The bug is caused by achors.  We call

Breakpoint 6, write_dependence_p (mem=0x7ffff69006f0, x=0x7ffff69006c0,
x_mode=SImode, x_addr=0x7ffff6900690, mem_canonicalized=true,
x_canonicalized=true, writep=false)
    at ../../gcc/alias.c:2897
2897      gcc_checking_assert (x_canonicalized
(gdb) p debug_rtx (x)
(mem:SI (plus:SI (mult:SI (reg:SI 110 [ off.0_2 ])
            (const_int 4 [0x4]))
        (symbol_ref:SI ("*.LANCHOR0") [flags 0x182])) [1 a S4 A32])
$38 = void
(gdb) p debug_rtx (mem)
(mem:SI (plus:SI (mult:SI (reg:SI 110 [ off.0_2 ])
            (const_int 4 [0x4]))
        (symbol_ref:SI ("b") [flags 0x2]  <var_decl 0x7ffff7ff8a20 b>)) [1 b S4
A32])
$39 = void

which is OK but we also have:
(gdb) p debug_rtx (x_addr)
(plus:SI (mult:SI (reg:SI 110 [ off.0_2 ])
        (const_int 4 [0x4]))
    (symbol_ref:SI ("*.LANCHOR0") [flags 0x182]))
$50 = void

and we dispatch to:
Breakpoint 9, base_alias_check (x=0x7ffff6900690, x_base=0x7ffff68fb5f0,
y=0x7ffff69006d8, y_base=0x7ffff68fef48, x_mode=SImode, y_mode=SImode) at
../../gcc/alias.c:2065
(gdb) p debug_rtx (x_base)
(symbol_ref:SI ("*.LANCHOR0") [flags 0x182])
$57 = void
(gdb) p debug_rtx (y_base)
(symbol_ref:SI ("b") [flags 0x2]  <var_decl 0x7ffff7ff8a20 b>)
$58 = void

and eventually we return 0 in:
  if (GET_CODE (x_base) == SYMBOL_REF && GET_CODE (y_base) == SYMBOL_REF)
    {
      tree x_decl = SYMBOL_REF_DECL (x_base);
      tree y_decl = SYMBOL_REF_DECL (y_base);

      /* We can assume that no stores are made to labels.  */
      if (!x_decl || !y_decl)
        return 0;
      return compare_base_decls (x_decl, y_decl) != 0;
    }

because x_base is NULL.  I suppose easy fix is to always return true for
anchor/decl compare, but perhaps there is a better way to check if the anchor
possibly corresponds to the declaration?

Reply via email to