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

            Bug ID: 99332
           Summary: ICE:inreset_sched_cycles_in_current_ebb, at
                    sel-sched.c:7147 with -fprofile-generate -O3
                    -fselective-scheduling -fselective-scheduling2
                    -fsel-sched-pipelining
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: qinzhao at gcc dot gnu.org
  Target Milestone: ---

This testing case is reduced from CPU2017 511.povray, it appears on aarch64
with both gcc11 and gcc10:

$ cat t.C
class OStream {
public:
  void printf(...);
};
typedef double VECTOR[3];
enum { X, Y, Z };
typedef struct ot_block_struct OT_BLOCK;
typedef int OT_NODE;
struct ot_block_struct {
  OT_BLOCK *next;
  VECTOR Point, S_Normal;
  VECTOR To_Nearest_Surface;
  short Bounce_Depth;
};
bool ot_write_block(OT_BLOCK *, void *);
bool ot_traverse(OT_NODE *, bool function(OT_BLOCK *, void *), void *handle) {
  bool oksofar;
  OT_BLOCK *this_block;
  while (this_block) {
    function(this_block, handle);
    this_block = this_block->next;
  }
  return oksofar;
}

bool ot_save_tree() {
  int *fd, *root;
  ot_traverse(root, ot_write_block, fd);
}

bool ot_write_block(OT_BLOCK *bl, void *fd) {
  ((OStream *)fd)->printf(
      bl[Z], bl->S_Normal[X] * int(bl->S_Normal[Z] * .5 * 254. + .499999),
      bl[Z], int(bl->To_Nearest_Surface[X]),
      int((bl->To_Nearest_Surface[Y] + 1.) * .5 * 254. + .499999),
      int((bl->To_Nearest_Surface[Z] + 1.) * .5 * 254. + .499999));
  return true;
}

[qzlocal@ca-dev-arm06 bug_2]$ sh t
/data1/qing/Install/latest/bin/g++ -fprofile-generate -O3
-fselective-scheduling -fselective-scheduling2 -fsel-sched-pipelining -c -o t.o
t.C
t.C: In function 'bool ot_save_tree()':
t.C:29:1: warning: no return statement in function returning non-void
[-Wreturn-type]
   29 | }
      | ^
during RTL pass: sched2
t.C:29:1: internal compiler error: in reset_sched_cycles_in_current_ebb, at
sel-sched.c:7147
0x1063387 reset_sched_cycles_in_current_ebb
        ../../latest_gcc/gcc/sel-sched.c:7147
0x1063387 sel_region_target_finish
        ../../latest_gcc/gcc/sel-sched.c:7220
0x1063387 sel_region_finish
        ../../latest_gcc/gcc/sel-sched.c:7276
0x1063387 sel_sched_region(int)
        ../../latest_gcc/gcc/sel-sched.c:7645
0x1063593 run_selective_scheduling()
        ../../latest_gcc/gcc/sel-sched.c:7720
0x103e70b rest_of_handle_sched2
        ../../latest_gcc/gcc/sched-rgn.c:3738
0x103e70b execute
        ../../latest_gcc/gcc/sched-rgn.c:3882
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.

CPU2017 511.povray cannot be compiled on aarch64 due to this bug.

Reply via email to