On Tue, Jan 10, 2023 at 04:33:59PM +0000, Wilco Dijkstra via Gcc-patches wrote:
> @@ -1204,10 +1203,15 @@ execute_cfa_program (const unsigned char *insn_ptr,
>       case DW_CFA_GNU_window_save:
>  #if defined (__aarch64__) && !defined (__ILP32__)
>         /* This CFA is multiplexed with Sparc.  On AArch64 it's used to toggle
> -          return address signing status.  */
> +          return address signing status.  The REG_UNDEFINED/UNSAVED states
> +          mean RA signing is enabled/disabled.  */
>         reg = DWARF_REGNUM_AARCH64_RA_STATE;
> -       gcc_assert (fs->regs.how[reg] == REG_UNSAVED);
> -       fs->regs.reg[reg].loc.offset ^= 1;
> +       gcc_assert (fs->regs.how[reg] == REG_UNSAVED
> +                   || fs->regs.how[reg] == REG_UNDEFINED);
> +       if (fs->regs.how[reg] == REG_UNSAVED)
> +         fs->regs.how[reg] = REG_UNDEFINED;
> +       else
> +         fs->regs.how[reg] = REG_UNSAVED;

Wouldn't the assert be better written just as:
          if (fs->regs.how[reg] == REG_UNSAVED)
            fs->regs.how[reg] = REG_UNDEFINED;
          else
            {
              gcc_assert (fs->regs.how[reg] == REG_UNDEFINED);
              fs->regs.how[reg] = REG_UNSAVED;
            }
?

Anyway, the sooner this makes it into gcc trunk, the better, it breaks quite
a lot of stuff.

        Jakub

Reply via email to