public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/113778] New: ICE: RTL check: expected elt 3 type 'e' or 'u', have '0' (rtx code_label) in PATTERN, at rtl.h:1506 with -march=armv9-a+sme -fhardened
@ 2024-02-05 21:05 zsojka at seznam dot cz
  2024-02-05 21:26 ` [Bug target/113778] " pinskia at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: zsojka at seznam dot cz @ 2024-02-05 21:05 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 113778
           Summary: ICE: RTL check: expected elt 3 type 'e' or 'u', have
                    '0' (rtx code_label) in PATTERN, at rtl.h:1506 with
                    -march=armv9-a+sme -fhardened
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zsojka at seznam dot cz
  Target Milestone: ---
              Host: x86_64-pc-linux-gnu
            Target: aarch64-unknown-linux-gnu

Created attachment 57333
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57333&action=edit
reduced testcase (from gcc.target/aarch64/sme/sibcall_6.c)

This might need RTL checking enabled.

Compiler output:
$ aarch64-unknown-linux-gnu-gcc -march=armv9-a+sme -fhardened sibcall_6.i
during RTL pass: mode_sw
sibcall_6.i: In function 'shared_to_normal':
sibcall_6.i:2:65: internal compiler error: RTL check: expected elt 3 type 'e'
or 'u', have '0' (rtx code_label) in PATTERN, at rtl.h:1506
    2 | void shared_to_normal() [[arm::inout("za")]] { normal_callee(); }
      |                                                                 ^
0x86155c rtl_check_failed_type2(rtx_def const*, int, int, int, char const*,
int, char const*)
        /repo/gcc-trunk/gcc/rtl.cc:761
0x86229d PATTERN(rtx_def const*)
        /repo/gcc-trunk/gcc/rtl.h:1506
0x864803 PATTERN(rtx_def const*)
        /repo/gcc-trunk/gcc/rtl.h:1506
0x864803 rtx_properties::try_to_add_insn(rtx_insn const*, bool)
        /repo/gcc-trunk/gcc/rtlanal.cc:2344
0x1721ce6 growing_rtx_properties<vec_rtx_properties_base>::add_insn(rtx_insn
const*, bool)::{lambda()#1}::operator()() const
        /repo/gcc-trunk/gcc/rtlanal.h:288
0x1721ce6 void
growing_rtx_properties<vec_rtx_properties_base>::repeat<growing_rtx_properties<vec_rtx_properties_base>::add_insn(rtx_insn
const*,
bool)::{lambda()#1}>(growing_rtx_properties<vec_rtx_properties_base>::add_insn(rtx_insn
const*, bool)::{lambda()#1})
        /repo/gcc-trunk/gcc/rtlanal.h:246
0x1721ce6 growing_rtx_properties<vec_rtx_properties_base>::add_insn(rtx_insn
const*, bool)
        /repo/gcc-trunk/gcc/rtlanal.h:288
0x1721ce6 aarch64_mode_emit
        /repo/gcc-trunk/gcc/config/aarch64/aarch64.cc:29450
0x230de87 optimize_mode_switching
        /repo/gcc-trunk/gcc/mode-switching.cc:1210
0x230de87 execute
        /repo/gcc-trunk/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.

$ aarch64-unknown-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=/repo/gcc-trunk/binary-latest-aarch64/bin/aarch64-unknown-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-r14-8795-20240204180638-g91e09b3a7e9-checking-yes-rtl-df-extra-aarch64/bin/../libexec/gcc/aarch64-unknown-linux-gnu/14.0.1/lto-wrapper
Target: aarch64-unknown-linux-gnu
Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++
--enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra
--with-cloog --with-ppl --with-isl
--with-sysroot=/usr/aarch64-unknown-linux-gnu --build=x86_64-pc-linux-gnu
--host=x86_64-pc-linux-gnu --target=aarch64-unknown-linux-gnu
--with-ld=/usr/bin/aarch64-unknown-linux-gnu-ld
--with-as=/usr/bin/aarch64-unknown-linux-gnu-as --disable-libstdcxx-pch
--prefix=/repo/gcc-trunk//binary-trunk-r14-8795-20240204180638-g91e09b3a7e9-checking-yes-rtl-df-extra-aarch64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 14.0.1 20240205 (experimental) (GCC)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug target/113778] ICE: RTL check: expected elt 3 type 'e' or 'u', have '0' (rtx code_label) in PATTERN, at rtl.h:1506 with -march=armv9-a+sme -fhardened
  2024-02-05 21:05 [Bug tree-optimization/113778] New: ICE: RTL check: expected elt 3 type 'e' or 'u', have '0' (rtx code_label) in PATTERN, at rtl.h:1506 with -march=armv9-a+sme -fhardened zsojka at seznam dot cz
@ 2024-02-05 21:26 ` pinskia at gcc dot gnu.org
  2024-02-07 13:21 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-02-05 21:26 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I noticed the loop which calls rtx_properties::add_insn does not check if the
insn was not a RTX_INSN (BARRIER, CODE_LABEL and NOTE can appeal bare in the
RTL IR but are not insns).

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug target/113778] ICE: RTL check: expected elt 3 type 'e' or 'u', have '0' (rtx code_label) in PATTERN, at rtl.h:1506 with -march=armv9-a+sme -fhardened
  2024-02-05 21:05 [Bug tree-optimization/113778] New: ICE: RTL check: expected elt 3 type 'e' or 'u', have '0' (rtx code_label) in PATTERN, at rtl.h:1506 with -march=armv9-a+sme -fhardened zsojka at seznam dot cz
  2024-02-05 21:26 ` [Bug target/113778] " pinskia at gcc dot gnu.org
@ 2024-02-07 13:21 ` jakub at gcc dot gnu.org
  2024-02-15 20:26 ` rsandifo at gcc dot gnu.org
  2024-02-20 14:41 ` rsandifo at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-02-07 13:21 UTC (permalink / raw)
  To: gcc-bugs

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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug target/113778] ICE: RTL check: expected elt 3 type 'e' or 'u', have '0' (rtx code_label) in PATTERN, at rtl.h:1506 with -march=armv9-a+sme -fhardened
  2024-02-05 21:05 [Bug tree-optimization/113778] New: ICE: RTL check: expected elt 3 type 'e' or 'u', have '0' (rtx code_label) in PATTERN, at rtl.h:1506 with -march=armv9-a+sme -fhardened zsojka at seznam dot cz
  2024-02-05 21:26 ` [Bug target/113778] " pinskia at gcc dot gnu.org
  2024-02-07 13:21 ` jakub at gcc dot gnu.org
@ 2024-02-15 20:26 ` rsandifo at gcc dot gnu.org
  2024-02-20 14:41 ` rsandifo at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: rsandifo at gcc dot gnu.org @ 2024-02-15 20:26 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Sandiford <rsandifo at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2024-02-15
           Assignee|unassigned at gcc dot gnu.org      |rsandifo at gcc dot gnu.org

--- Comment #3 from Richard Sandiford <rsandifo at gcc dot gnu.org> ---
Possibly the same as PR113220

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug target/113778] ICE: RTL check: expected elt 3 type 'e' or 'u', have '0' (rtx code_label) in PATTERN, at rtl.h:1506 with -march=armv9-a+sme -fhardened
  2024-02-05 21:05 [Bug tree-optimization/113778] New: ICE: RTL check: expected elt 3 type 'e' or 'u', have '0' (rtx code_label) in PATTERN, at rtl.h:1506 with -march=armv9-a+sme -fhardened zsojka at seznam dot cz
                   ` (2 preceding siblings ...)
  2024-02-15 20:26 ` rsandifo at gcc dot gnu.org
@ 2024-02-20 14:41 ` rsandifo at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: rsandifo at gcc dot gnu.org @ 2024-02-20 14:41 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Sandiford <rsandifo at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
             Status|ASSIGNED                    |RESOLVED

--- Comment #4 from Richard Sandiford <rsandifo at gcc dot gnu.org> ---
Confirmed that this is the same as PR113220.

*** This bug has been marked as a duplicate of bug 113220 ***

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-02-20 14:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-05 21:05 [Bug tree-optimization/113778] New: ICE: RTL check: expected elt 3 type 'e' or 'u', have '0' (rtx code_label) in PATTERN, at rtl.h:1506 with -march=armv9-a+sme -fhardened zsojka at seznam dot cz
2024-02-05 21:26 ` [Bug target/113778] " pinskia at gcc dot gnu.org
2024-02-07 13:21 ` jakub at gcc dot gnu.org
2024-02-15 20:26 ` rsandifo at gcc dot gnu.org
2024-02-20 14:41 ` rsandifo at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).