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

            Bug ID: 125915
           Summary: [amdgcn] infinite recursion generating DImode load
                    from flat_scratch address space
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: arsen at gcc dot gnu.org
  Target Milestone: ---

the following testcase:

  __UINT64_TYPE__
  foo (__UINT64_TYPE__ __flat_scratch* i)
  { return *i; }

... never finishes compiling; it runs out of stack during expand, as it
recurses forever in gen_movdi:

    if (!lra_in_progress && !reload_completed
        && !gcn_valid_move_p (<MODE>mode, operands[0], operands[1]))
      {
        /* Something is probably trying to generate a move
           which can only work indirectly.
           E.g. Move from LDS memory to SGPR hardreg
             or MEM:QI to SGPR.  */
        rtx tmpreg = gen_reg_rtx (<MODE>mode);
        emit_insn (gen_mov<mode> (tmpreg, operands[1]));
        emit_insn (gen_mov<mode> (operands[0], tmpreg));
        DONE;
      }

printing the operands from the body of the 'if', we get:

  =========
  (reg:DI 683 [ _3 ])
  (mem:DI (reg/f:DI 686) [2 *i_2(D)+0 S8 A64 AS3])
  =========
  (reg:DI 687)
  (mem:DI (reg/f:DI 686) [2 *i_2(D)+0 S8 A64 AS3])

... and so on.

Reply via email to