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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Just -march=armv9-a+sme -fstack-clash-protection is needed.
early_ra::preprocess_insns as the only other user of vec_rtx_properties does:
  for (rtx_insn *insn = get_insns (); insn; insn = NEXT_INSN (insn))
    {
      if (!NONDEBUG_INSN_P (insn))
        continue;

      // Mark all registers that occur in addresses as needing a GPR.
      vec_rtx_properties properties;
      properties.add_insn (insn, true);
and I think only NONDEBUG_INSN_P can actually clobber anything (DEBUG_INSNs
can't and other rtx_insns don't even have a PATTERN).
But
--- a/gcc/config/aarch64/aarch64.cc
+++ b/gcc/config/aarch64/aarch64.cc
@@ -29491,6 +29491,9 @@ aarch64_mode_emit (int entity, int mode, int prev_mode,
HARD_REG_SET live)
   HARD_REG_SET clobbers = {};
   for (rtx_insn *insn = seq; insn; insn = NEXT_INSN (insn))
     {
+      if (!NONDEBUG_INSN_P (insn))
+       continue;
+
       vec_rtx_properties properties;
       properties.add_insn (insn, false);
       for (rtx_obj_reference ref : properties.refs ())
doesn't actually fix this, we ICE elsewhere:
./cc1 -quiet -nostdinc pr113778.c -march=armv9-a+sme -fstack-clash-protection
during RTL pass: mode_sw
pr113778.c: In function ‘shared_to_normal’:
pr113778.c:2:65: internal compiler error: Segmentation fault
    2 | void shared_to_normal() [[arm::inout("za")]] { normal_callee(); }
      |                                                                 ^
0x171054c crash_signal
        ../../gcc/toplev.cc:317
0xfe7d1d rtl_verify_bb_pointers
        ../../gcc/cfgrtl.cc:2834
0xfe7ede rtl_verify_flow_info_1
        ../../gcc/cfgrtl.cc:2886
0xfe864a rtl_verify_flow_info
        ../../gcc/cfgrtl.cc:3134
0xfcdb08 verify_flow_info()
        ../../gcc/cfghooks.cc:283
0xfc4548 checking_verify_flow_info()
        ../../gcc/cfghooks.h:214
0x2a4dac5 try_optimize_cfg
        ../../gcc/cfgcleanup.cc:2980
0x2a4df9e cleanup_cfg(int)
        ../../gcc/cfgcleanup.cc:3143
0x2c02d0d optimize_mode_switching
        ../../gcc/mode-switching.cc:1261
0x2c02dee execute
        ../../gcc/mode-switching.cc:1309
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

mode switching isn't prepared for targetm.mode_switching.confluence to emit
labels that would need splitting the current bb (say using
find_sub_basic_blocks).
But, disabling -fstack-clash-protection temporarily in such sequences means it
will not act the way it is supposed to.

Reply via email to