public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/114069] New: Type punning RISC-V vectors causes ICE at -O1
@ 2024-02-23  7:24 zingaburga+gcc at hotmail dot com
  2024-02-24  2:12 ` [Bug middle-end/114069] Type punning RISC-V and SVE " pinskia at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: zingaburga+gcc at hotmail dot com @ 2024-02-23  7:24 UTC (permalink / raw)
  To: gcc-bugs

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug middle-end/114069] Type punning RISC-V and SVE vectors causes ICE at -O1
  2024-02-23  7:24 [Bug target/114069] New: Type punning RISC-V vectors causes ICE at -O1 zingaburga+gcc at hotmail dot com
@ 2024-02-24  2:12 ` pinskia at gcc dot gnu.org
  2024-02-24  2:16 ` pinskia at gcc dot gnu.org
  2024-02-24  2:22 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-02-24  2:12 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Type punning RISC-V vectors |Type punning RISC-V and SVE
                   |causes ICE at -O1           |vectors causes ICE at -O1
   Last reconfirmed|                            |2024-02-24
           Keywords|                            |ice-on-valid-code
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
             Target|riscv                       |riscv aarch64
          Component|target                      |middle-end

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.

This is not only a RISCV issue but also happens with aarch64's SVE types too:
```
#include <arm_sve.h>

svint8_t f(svuint8x2_t s) {
        return *reinterpret_cast<svint8_t*>(&s);
}

```

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug middle-end/114069] Type punning RISC-V and SVE vectors causes ICE at -O1
  2024-02-23  7:24 [Bug target/114069] New: Type punning RISC-V vectors causes ICE at -O1 zingaburga+gcc at hotmail dot com
  2024-02-24  2:12 ` [Bug middle-end/114069] Type punning RISC-V and SVE " pinskia at gcc dot gnu.org
@ 2024-02-24  2:16 ` pinskia at gcc dot gnu.org
  2024-02-24  2:22 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-02-24  2:16 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://github.com/llvm/llv
                   |                            |m-project/issues/82859

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note clang crashes also on the SVE case but not the RISCV issue.
Filed https://github.com/llvm/llvm-project/issues/82859 for the SVE issue.

Note GCC is crashing in general code for both really.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug middle-end/114069] Type punning RISC-V and SVE vectors causes ICE at -O1
  2024-02-23  7:24 [Bug target/114069] New: Type punning RISC-V vectors causes ICE at -O1 zingaburga+gcc at hotmail dot com
  2024-02-24  2:12 ` [Bug middle-end/114069] Type punning RISC-V and SVE " pinskia at gcc dot gnu.org
  2024-02-24  2:16 ` pinskia at gcc dot gnu.org
@ 2024-02-24  2:22 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-02-24  2:22 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Depends on|                            |103433
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=103433

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Oh the SVE issue was already filed as PR 103433 but I think this is the same.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103433
[Bug 103433] ICE in convert_move, at expr.c:219

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-02-24  2:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-23  7:24 [Bug target/114069] New: Type punning RISC-V vectors causes ICE at -O1 zingaburga+gcc at hotmail dot com
2024-02-24  2:12 ` [Bug middle-end/114069] Type punning RISC-V and SVE " pinskia at gcc dot gnu.org
2024-02-24  2:16 ` pinskia at gcc dot gnu.org
2024-02-24  2:22 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).