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

Jim Wilson <wilson at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2019-03-06
     Ever confirmed|0                           |1

--- Comment #3 from Jim Wilson <wilson at gcc dot gnu.org> ---
In the caller, riscv_classify_address, we have the address which contains a
symbol.  We can get the VAR_DECL from the symbol.  We can then get size and
alignment from the symbol.  However, there is no guarantee that a decl is in
there, it depends on what kind of symbol this is.

In the aarch64/aarch64.c file, I see code similar to what we need, which among
the checks has this
              else if (SYMBOL_REF_DECL (sym))
                align = DECL_ALIGN (SYMBOL_REF_DECL (sym));
There is simpler code in the mips/mips.c file in the
mips_offset_within_alignment_p function.

RISC-V is normally strict align, so it should still be safe to assume mode
alignment if strict align is on, if there is no SYMBOL_REF_DECL.

An even simpler solution, as I mentioned earlier, is just
  if (mode == BLKmode)
    return false;
and that may give a result just as good as checking the SYMBOL_REF_DECL.

Reply via email to