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

            Bug ID: 119371
           Summary: [15 Regression][OpenMP] accel/nvptx-none/lto1: ICE in
                    in emit_move_insn, at expr.cc:4636
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code, openmp
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
                CC: tschwinge at gcc dot gnu.org, vries at gcc dot gnu.org
  Target Milestone: ---
            Target: nvptx

That's with omptest's t-parallel-for-simd/test.c
https://github.com/doru1004/omptests/blob/main/t-parallel-for-simd/test.c

The ICE is in  accel/nvptx-none/lto1 →

$ g++ -fopenmp t-parallel-for-simd/test.c -O1 -w -foffload=nvptx-none

t-parallel-for-simd/test.c:212:5: internal compiler error: in emit_move_insn,
at expr.cc:4636

* * *

$ g++ -fopenmp input-a-2.i -O1 -w -foffload=nvptx-none

Reduced testcase:
------------------
main() {
  int threads[1];
  for (;;)
#pragma omp target simd lastprivate(threads)
    for (int i = 0; i < 4; i++)
      ;
}
------------------

input-a-2.i: In function ‘main._omp_fn.0’:
input-a-2.i:5:5: internal compiler error: in emit_move_insn, at expr.cc:4636
    5 |     for (int i = 0; i < 4; i++)
      |     ^
0x1b73a41 internal_error(char const*, ...)
        /home/tob/repos/gcc/gcc/diagnostic-global-context.cc:517
0x86ac5d fancy_abort(char const*, int, char const*)
        /home/tob/repos/gcc/gcc/diagnostic.cc:1722
0x69a392 emit_move_insn(rtx_def*, rtx_def*)
        /home/tob/repos/gcc/gcc/expr.cc:4636
0xa16fe0 copy_to_mode_reg(machine_mode, rtx_def*)
        /home/tob/repos/gcc/gcc/explow.cc:659
0xd02242 maybe_legitimize_operand
        /home/tob/repos/gcc/gcc/optabs.cc:8020
0xd02242 maybe_legitimize_operands(insn_code, unsigned int, unsigned int,
expand_operand*)
        /home/tob/repos/gcc/gcc/optabs.cc:8163
0xcfea49 maybe_gen_insn(insn_code, unsigned int, expand_operand*)
        /home/tob/repos/gcc/gcc/optabs.cc:8182
0xd02dd8 maybe_expand_insn(insn_code, unsigned int, expand_operand*)
        /home/tob/repos/gcc/gcc/optabs.cc:8237
0xd02dd8 expand_insn(insn_code, unsigned int, expand_operand*)
        /home/tob/repos/gcc/gcc/optabs.cc:8268
0xb7009b expand_GOMP_SIMT_XCHG_IDX
        /home/tob/repos/gcc/gcc/internal-fn.cc:651
0x91b23f expand_call_stmt
        /home/tob/repos/gcc/gcc/cfgexpand.cc:3049

* * *

The failing assert is:

4636      gcc_assert (mode != BLKmode
4637                  && (GET_MODE (y) == mode || GET_MODE (y) == VOIDmode));

(gdb) p mode
$1 = E_BLKmode

(gdb) p debug_rtx(y)
(mem/c:BLK (reg/f:DI 17 virtual-stack-vars) [1 D.1763+0 S4 A128])

(gdb) p debug_rtx(x)
(reg:BLK 46)


(gdb) up
#2  0x0000000000a16fe1 in copy_to_mode_reg (mode=mode@entry=E_BLKmode,
x=0x7ffff750e048) at /home/tob/repos/gcc/gcc/explow.cc:659
659         emit_move_insn (temp, x);

and:

#4  maybe_legitimize_operands (icode=icode@entry=CODE_FOR_omp_simt_xchg_idx,
opno=opno@entry=0, nops=nops@entry=3, ops=ops@entry=0x7fffffffc970) at
/home/tob/repos/gcc/gcc/optabs.cc:8163
8163          if (j == i && !maybe_legitimize_operand (icode, opno + i,
&ops[i]))

(gdb) p icode
$10 = CODE_FOR_omp_simt_xchg_idx

Reply via email to