> Hi Jin, > > In riscv_regno, you seem to be calling true_regnum before reload, > which is not allowed. While adding rhx fusions on top of yours, > it caused segmentation faults during dep_fusion1, which happens > before reload: > > /SCRATCH/loeka/gcc/gcc/testsuite/gcc.target/riscv/stack_save_restore_1.c:40:1: > > internal compiler error: Segmentation fault > 0x48916eb internal_error(char const*, ...) > /SCRATCH/loeka/gcc/gcc/diagnostic-global-context.cc:787 > 0x1f9bb44 crash_signal > /SCRATCH/loeka/gcc/gcc/toplev.cc:325 > 0x1c8d24f true_regnum(rtx_def const*) > /SCRATCH/loeka/gcc/gcc/jump.cc:1870 > 0x2746a82 riscv_regno > /SCRATCH/loeka/gcc/gcc/config/riscv/riscv-fusion.cc:138 > 0x274a93b riscv_lui_st_pair_p > /SCRATCH/loeka/gcc/gcc/config/riscv/riscv-fusion.cc:22820x274aa51 > riscv_fuse_lui_st > /SCRATCH/loeka/gcc/gcc/config/riscv/riscv-fusion.cc:23080x274ad6d > riscv_get_fusion_pair_type(rtx_insn*, rtx_insn*) > /SCRATCH/loeka/gcc/gcc/config/riscv/riscv-fusion.cc:2491 > 0x274ae28 riscv_macro_fusion_pair_p(rtx_insn*, rtx_insn*) > /SCRATCH/loeka/gcc/gcc/config/riscv/riscv-fusion.cc:2508 > 0x44fc779 execute > /SCRATCH/loeka/gcc/gcc/dep-fusion.cc:103 > > Kind regards, > Loeka
Hi Loeka, Thank you for the report, and sorry for the trouble. V5 did call true_regnum before handling pseudos. In the V6 patch posted on October 22, I changed the order: when can_create_pseudo_p() is true, the helper returns the pseudo register number for a pseudo or its SUBREG before reaching true_regnum. This avoids accessing the uninitialized reg_renumber array on that path. The updated patch is here: https://patchwork.sourceware.org/project/gcc/patch/[email protected]/ Could you retry with this version and let me know whether the problem still occurs? Thanks, Jin
