riscv-non-isa / rvv-intrinsic-doc

https://jira.riscv.org/browse/RVG-153
BSD 3-Clause "New" or "Revised" License
287 stars 90 forks source link

[Error] GCC Crashes while passing some intrinsics as parameter of another intrinsics #281

Closed Tameem97 closed 1 year ago

Tameem97 commented 1 year ago

Hi,

This is not an important or critical issue but just reporting it since I am getting it frequently for vmv, vredsum, and reinterpret intrinsics \ While passing some intrinsics as parameter of another intrinsics the GCC crashes (these only include vmv, vredsum and reinterpret), for example for this one

sum1 += __riscv_vmv_x_s_i16m1_i16(__riscv_vredsum_vs_i16m1_i16m1(p0, vzero, vl));

\ Definitely it can be rewrite as this, which work correctly.

      vint16m1_t vs0 = __riscv_vredsum_vs_i16m1_i16m1(p0, vzero, vl) 
      sum1 += __riscv_vmv_x_s_i16m1_i16(vs0);

Error Message

during RTL pass: shorten
k0q2.c: In function 'vec_prod':
k0q2.c:122:1: internal compiler error: Segmentation fault
  122 | }
      | ^
0xc5e653 crash_signal
        /media/moiz/083742A4094B2073/riscv/gcc/gcc/toplev.cc:314
0x7f10eaa3bcef ???
        ./signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0
0x1488444 const_csr_operand(rtx_def*, machine_mode)
        /media/moiz/083742A4094B2073/riscv/gcc/gcc/config/riscv/predicates.md:44
0x1488444 csr_operand(rtx_def*, machine_mode)
        /media/moiz/083742A4094B2073/riscv/gcc/gcc/config/riscv/predicates.md:46
0x150a1ef recog_157
        /media/moiz/083742A4094B2073/riscv/gcc/gcc/config/riscv/iterators.md:72
0x150a1ef recog(rtx_def*, rtx_insn*, int*)
        /media/moiz/083742A4094B2073/riscv/gcc/gcc/config/riscv/iterators.md:58
0x1303375 recog_memoized(rtx_insn*)
        /media/moiz/083742A4094B2073/riscv/gcc/gcc/recog.h:273
0x1303375 insn_default_length(rtx_insn*)
        /media/moiz/083742A4094B2073/riscv/gcc/gcc/config/riscv/riscv.md:451
0x91e4ed shorten_branches(rtx_insn*)
        /media/moiz/083742A4094B2073/riscv/gcc/gcc/final.cc:1088
0x91e533 rest_of_handle_shorten_branches
        /media/moiz/083742A4094B2073/riscv/gcc/gcc/final.cc:4336
0x91e533 execute
        /media/moiz/083742A4094B2073/riscv/gcc/gcc/final.cc:4365
Please submit a full bug report, with preprocessed source (by using -freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

Thank you,

kito-cheng commented 1 year ago

Could you provide a self contained code fragment? I mean something can feed to compiler, and also the version of gcc, thanks :)

Tameem97 commented 1 year ago

Thank you for your reply!

Here is the link to code: https://godbolt.org/z/TMb5PP6zE

Also, I am using gcc 13.2 version

Tameem97 commented 1 year ago

I just check on compiler explorer that this won't cause error with GCC trunk version, which means whatever causing this error was fixed in that version, so closing this issue