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

            Bug ID: 114069
           Summary: Type punning RISC-V vectors causes ICE at -O1
           Product: gcc
           Version: 13.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zingaburga+gcc at hotmail dot com
  Target Milestone: ---

Type punning a RISC-V vector causes ICE under RV64 GCC 13.x/trunk:
https://godbolt.org/z/sajcb3T7z

Seems to work with -O0 instead of -O1, on GCC 13.x


Code:

#include <riscv_vector.h>

vbool8_t f(vuint8m1_t s) {
        // unavailable in GCC 13, available in trunk
        //return __riscv_vreinterpret_v_u8m1_b8(s);

        // causes ICE in GCC 13 + trunk
        return *reinterpret_cast<vbool8_t*>(&s);

        // this seems to work without issue
        vuint8mf8_t f = __riscv_vlmul_trunc_v_u8m1_u8mf8(s);
        return *reinterpret_cast<vbool8_t*>(&f);
}


Compiler options: -march=rv64gcv -O1


Output:

during RTL pass: expand
<source>: In function 'vbool8_t f(vuint8m1_t)':
<source>:8:47: internal compiler error: in convert_move, at expr.cc:219
    8 |         return *reinterpret_cast<vbool8_t*>(&s);
      |                                               ^
0x7fb7d5029e3f __libc_start_main
        ???:0
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.
Compiler returned: 1

Reply via email to