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

            Bug ID: 111076
           Summary: RISC-V: segmentation fault during RTL pass: shorten
                    (debug build)
           Product: gcc
           Version: 13.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: maksim.shabunin at gmail dot com
  Target Milestone: ---

Created attachment 55765
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55765&action=edit
Preprocessed source file

We are experiencing an issue when building the OpenCV library for RISC-V with
RVV support in DEBUG configuration using GCC 13.2.1:

    /work/chains/riscv-gcc-13.2.1/bin/riscv64-unknown-linux-gnu-g++
--sysroot=/work/chains/riscv-gcc-13.2.1/sysroot
-DOPENCV_ALLOCATOR_STATS_COUNTER_TYPE=int -D_USE_MATH_DEFINES
-D__OPENCV_BUILD=1 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS
-D__STDC_LIMIT_MACROS -I/work/opencv/modules/core/include
-I/work/build-opencv-rvv/modules/core -I/work/opencv/3rdparty/zlib
-I/work/build-opencv-rvv/3rdparty/zlib -isystem /work/build-opencv-rvv
-march=rv64gc  -fmax-errors=1 -Wfatal-errors -fsigned-char -W -Wall
-Wreturn-type -Wnon-virtual-dtor -Waddress -Wsequence-point -Wformat
-Wformat-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith
-Wshadow -Wsign-promo -Wuninitialized -Wsuggest-override
-Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3
-Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer
-ffunction-sections -fdata-sections  -march=rv64gcv1p0 -DCV_RVV_SCALABLE
-fvisibility=hidden -fvisibility-inlines-hidden -g  -O0 -DDEBUG -D_DEBUG -fPIC
-std=c++11 -MD -MT
modules/core/CMakeFiles/opencv_core.dir/src/count_non_zero.dispatch.cpp.o -MF
modules/core/CMakeFiles/opencv_core.dir/src/count_non_zero.dispatch.cpp.o.d -o
modules/core/CMakeFiles/opencv_core.dir/src/count_non_zero.dispatch.cpp.o -c
/work/opencv/modules/core/src/count_non_zero.dispatch.cpp -freport-bug

    <... several -Wsign-compare warnings ...>

    during RTL pass: shorten
    In file included from
/work/opencv/modules/core/include/opencv2/core/hal/intrin_rvv_scalable.hpp:146:
   
/work/opencv/modules/core/include/opencv2/core/hal/intrin_rvv_compat_overloaded.hpp:
In function 'cv::hal_baseline::VTraits<__rvv_uint64m1_t>::lane_type
cv::hal_baseline::__riscv_vmv_x(const v_uint64&)':
   
/work/opencv/modules/core/include/opencv2/core/hal/intrin_rvv_compat_overloaded.hpp:154:1:
internal compiler error: Segmentation fault
      154 | }
          | ^
   
/work/opencv/modules/core/include/opencv2/core/hal/intrin_rvv_compat_overloaded.hpp:167:1:
note: in expansion of macro 'OPENCV_HAL_IMPL_RVV_FUN_EXTRACT'
      167 | OPENCV_HAL_IMPL_RVV_FUN_EXTRACT(v_uint64, u64)
          | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    0xe038c3 crash_signal
        ../.././gcc/gcc/toplev.cc:314
    0x7f445264251f ???
        ./signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0
    0x16038c4 const_csr_operand(rtx_def*, machine_mode)
        ../.././gcc/gcc/config/riscv/predicates.md:44
    0x16038c4 csr_operand(rtx_def*, machine_mode)
        ../.././gcc/gcc/config/riscv/predicates.md:46
    0x166e88d recog_157
        ../.././gcc/gcc/config/riscv/iterators.md:72
    0x167c247 recog(rtx_def*, rtx_insn*, int*)
        ../.././gcc/gcc/config/riscv/iterators.md:58
    0x147f00d recog_memoized(rtx_insn*)
        ../.././gcc/gcc/recog.h:273
    0x147f00d insn_default_length(rtx_insn*)
        ../.././gcc/gcc/config/riscv/riscv.md:451
    0xac4ea5 shorten_branches(rtx_insn*)
        ../.././gcc/gcc/final.cc:1088
    0xac4ef3 rest_of_handle_shorten_branches
        ../.././gcc/gcc/final.cc:4336
    0xac4ef3 execute
        ../.././gcc/gcc/final.cc:4365
    Please submit a full bug report, with preprocessed source.
    Please include the complete backtrace with any bug report.
    See <https://gcc.gnu.org/bugs/> for instructions.
    The bug is not reproducible, so it is likely a hardware or OS problem.

* Version: riscv64-unknown-linux-gnu-g++ (g91a5bdf2941) 13.2.1 20230818
* Preprocessed source file attached.
* The same library version (latest commit on 4.x branch) can be built in
Release mode without issues.
  • [Bug rtl-optimization/111076... maksim.shabunin at gmail dot com via Gcc-bugs

Reply via email to