Bug 110264 - internal compiler error: riscv_vector::vector_insn_info::get_avl_reg_rtx
Summary: internal compiler error: riscv_vector::vector_insn_info::get_avl_reg_rtx
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 13.1.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2023-06-15 07:39 UTC by Mathieu Malaterre
Modified: 2023-06-27 03:50 UTC (History)
5 users (show)

See Also:
Host:
Target: riscv64-linux-gnu
Build:
Known to work:
Known to fail:
Last reconfirmed: 2023-06-17 00:00:00


Attachments
preprocessed source (443.77 KB, application/x-gzip)
2023-06-15 07:39 UTC, Mathieu Malaterre
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mathieu Malaterre 2023-06-15 07:39:18 UTC
Created attachment 55324 [details]
preprocessed source

I cannot compile highway on riscv/rv64gcv1p0 with gcc-13.

Compilation fails with:

% /usr/bin/g++-13  -freport-bug -DHWY_SHARED_DEFINE -I"/home/malat/highway-1.0.5~git20230612.46fb57d" -g -O2 -ffile-prefix-map=/home/malat/highway-1.0.5~git20230612.46fb57d=. -fstack-protector-strong -Wformat -Werror=format-security -DHWY_BROKEN_EMU128=0 -Wdate-time -D_FORTIFY_SOURCE=2 -fPIE -fvisibility=hidden -fvisibility-inlines-hidden -Wno-builtin-macro-redefined -D__DATE__=\"redacted\" -D__TIMESTAMP__=\"redacted\" -D__TIME__=\"redacted\" -fmerge-all-constants -Wall -Wextra -Wconversion -Wsign-conversion -Wvla -Wnon-virtual-dtor -fmath-errno -fno-exceptions -march=rv64gcv1p0 -Werror -DHWY_IS_TEST=1 -DGTEST_HAS_PTHREAD=1 -MD -MT CMakeFiles/find_test.dir/hwy/contrib/algo/find_test.cc.o -MF CMakeFiles/find_test.dir/hwy/contrib/algo/find_test.cc.o.d -o CMakeFiles/find_test.dir/hwy/contrib/algo/find_test.cc.o -c '/home/malat/highway-1.0.5~git20230612.46fb57d/hwy/contrib/algo/find_test.cc'
during RTL pass: vsetvl
/home/malat/highway-1.0.5~git20230612.46fb57d/hwy/contrib/algo/find_test.cc: In function 'void hwy::N_RVV::ForeachCountAndMisalign<Test>::operator()(T, D) const [with T = float; D = hwy::N_RVV::Simd<float, 2048, -2>; Test = hwy::N_RVV::TestFindIf]':
/home/malat/highway-1.0.5~git20230612.46fb57d/hwy/contrib/algo/find_test.cc:96:3: internal compiler error: Segmentation fault
   96 |   }
      |   ^
0x85d651 crash_signal
        ../../src/gcc/toplev.cc:314
0xb4c608 riscv_vector::vector_insn_info::get_avl_reg_rtx() const
        ../../src/gcc/config/riscv/riscv-vsetvl.h:393
0xb4c608 insert_vsetvl
        ../../src/gcc/config/riscv/riscv-vsetvl.cc:735
0xb4f93f pass_vsetvl::commit_vsetvls()
        ../../src/gcc/config/riscv/riscv-vsetvl.cc:3816
0xb4feed pass_vsetvl::pre_vsetvl()
        ../../src/gcc/config/riscv/riscv-vsetvl.cc:3915
0xb5ae83 pass_vsetvl::lazy_vsetvl()
        ../../src/gcc/config/riscv/riscv-vsetvl.cc:4218
0xb5b091 pass_vsetvl::execute(function*)
        ../../src/gcc/config/riscv/riscv-vsetvl.cc:4253
0xb5b091 pass_vsetvl::execute(function*)
        ../../src/gcc/config/riscv/riscv-vsetvl.cc:4234
Please submit a full bug report, with preprocessed source.
Please include the complete backtrace with any bug report.
See <file:///usr/share/doc/gcc-13/README.Bugs> for instructions.
Preprocessed source stored into /tmp/ccBEZCN1.out file, please attach this to your bugreport.
Comment 1 Mathieu Malaterre 2023-06-15 07:41:16 UTC
This is not a duplicate of PR/109535 since I can compile the previously mentionned TU transform_test.cc just fine.
Comment 2 JuzheZhong 2023-06-16 03:53:29 UTC
Thanks for reporting this. I am trying to reduce the testcase. Hopefully will fix it today. But we need kito or Jeff to backport it into GCC-13.

Thanks.
Comment 3 JuzheZhong 2023-06-16 08:12:16 UTC
I fixed this issue:
https://gcc.gnu.org/pipermail/gcc-patches/2023-June/621953.html

Hope it will be landed into trunk and backport to GCC-13 soon.

Thanks.
Comment 4 GCC Commits 2023-06-16 23:29:58 UTC
The master branch has been updated by Pan Li <panli@gcc.gnu.org>:

https://gcc.gnu.org/g:dd6e1cbac8682106c5167c105f2807014288b852

commit r14-1898-gdd6e1cbac8682106c5167c105f2807014288b852
Author: Juzhe-Zhong <juzhe.zhong@rivai.ai>
Date:   Fri Jun 16 16:02:31 2023 +0800

    RISC-V: Fix VL operand bug in VSETVL PASS[PR110264]
    
    This patch fixes this issue happens on both GCC-13 and GCC-14.
    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110264
    
    The testcase is too big and I failed to reduce it so I didn't append
    test into this patch.
    
    This patch should not only land into GCC-14 but also should backport to GCC-13.
    
            PR target/110264
    
    gcc/ChangeLog:
    
            * config/riscv/riscv-vsetvl.cc (insert_vsetvl): Fix bug.
Comment 5 Jeffrey A. Law 2023-06-17 22:10:44 UTC
Note that Pan can cherry pick it into gcc-13.  Typically folks wait a week or so after the patch is on the trunk to see if there's any fallout.  Given that I don't expect gcc-13.2 until late summer, we've certainly got time.
Comment 6 GCC Commits 2023-06-27 02:56:09 UTC
The releases/gcc-13 branch has been updated by Pan Li <panli@gcc.gnu.org>:

https://gcc.gnu.org/g:2f3eedccaff8b6c65869ed50a7733138740325ff

commit r13-7482-g2f3eedccaff8b6c65869ed50a7733138740325ff
Author: Juzhe-Zhong <juzhe.zhong@rivai.ai>
Date:   Fri Jun 16 16:02:31 2023 +0800

    RISC-V: Fix VL operand bug in VSETVL PASS[PR110264]
    
    This patch fixes this issue happens on both GCC-13 and GCC-14.
    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110264
    
    The testcase is too big and I failed to reduce it so I didn't append
    test into this patch.
    
    This patch should not only land into GCC-14 but also should backport to GCC-13.
    
            PR target/110264
    
    gcc/ChangeLog:
    
            * config/riscv/riscv-vsetvl.cc (insert_vsetvl): Fix bug.
    
    (cherry picked from commit dd6e1cbac8682106c5167c105f2807014288b852)
Comment 7 Kito Cheng 2023-06-27 03:50:50 UTC
Fixed on trunk and backported to GCC 13