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

            Bug ID: 87305
           Summary: [9 Regression] Segfault in end_hard_regno in
                    setup_live_pseudos_and_spill_after_risky_transforms on
                    aarch64 big-endian
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ktkachov at gcc dot gnu.org
                CC: rsandifo at gcc dot gnu.org
  Target Milestone: ---

The testcase:
int a;
int b[5];
int fn1() {
  short c;
  a = 0;
  for (; a <= 4; a++) {
    c = 3;
    for (; c >= 0; c--) {
      if (b[c + 1])
        break;
      --b[c];
    }
  }
  return a;
}

ICEs with -Ofast -mbig-endian on aarch64

test.c:15:1: internal compiler error: Segmentation fault
15 | }
   | ^
0xc310b1 crash_signal
        $GCC/gcc/toplev.c:325
0xa87998 end_hard_regno
        $GCC/gcc/regs.h:266
0xa87998 add_to_hard_reg_set
        $GCC/gcc/regs.h:278
0xa87998 setup_live_pseudos_and_spill_after_risky_transforms
        $GCC/gcc/lra-assigns.c:1219
0xa87998 lra_assign(bool&)
        $GCC/gcc/lra-assigns.c:1617
0xa83da4 lra(_IO_FILE*)
        $GCC/gcc/lra.c:2508
0xa3b3d6 do_reload
        $GCC/gcc/ira.c:5469
0xa3b3d6 execute
        $GCC/gcc/ira.c:5653
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

This seems to be due to a subreg being involved in a vector operation.
My patch[1] to disable paradoxical subregs during vector initialisation in
aarch64 "fixes" the ICE but it was not applied as it was just papering over a
problem in the midend.

[1] https://gcc.gnu.org/ml/gcc-patches/2018-05/msg01635.html

Reply via email to