public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/114352] RISC-V: ICE when __attribute__((target("arch=+v")) and build with rv64gc -O3
Date: Fri, 22 Mar 2024 02:36:51 +0000	[thread overview]
Message-ID: <bug-114352-4-8YNRU0GDko@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-114352-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Pan Li <panli@gcc.gnu.org>:

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

commit r14-9604-gd3c24e9e55a7cf18df313a8b32b6de4b3ba81013
Author: Pan Li <pan2.li@intel.com>
Date:   Mon Mar 18 11:21:29 2024 +0800

    RISC-V: Bugfix ICE for __attribute__((target("arch=+v"))

    This patch would like to fix one ICE for __attribute__((target("arch=+v"))
    and likewise extension(s). Given we have sample code as below:

    void __attribute__((target("arch=+v")))
    test_2 (int *a, int *b, int *out, unsigned count)
    {
      unsigned i;
      for (i = 0; i < count; i++)
       out[i] = a[i] + b[i];
    }

    It will have ICE when build with -march=rv64gc -O3.

    test.c: In function âtest_2â:
    test.c:4:1: internal compiler error: Floating point exception
    4 | {
          | ^
    0x1a5891b crash_signal
    .../__RISC-V_BUILD__/../gcc/toplev.cc:319
    0x7f0a7884251f ???
            ./signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0
    0x1f51ba4 riscv_hard_regno_nregs
            .../__RISC-V_BUILD__/../gcc/config/riscv/riscv.cc:8143
    0x1967bb9 init_reg_modes_target()
            .../__RISC-V_BUILD__/../gcc/reginfo.cc:471
    0x13fc029 init_emit_regs()
            .../__RISC-V_BUILD__/../gcc/emit-rtl.cc:6237
    0x1a5b83d target_reinit()
            .../__RISC-V_BUILD__/../gcc/toplev.cc:1936
    0x35e374d save_target_globals()
            .../__RISC-V_BUILD__/../gcc/target-globals.cc:92
    0x35e381f save_target_globals_default_opts()
            .../__RISC-V_BUILD__/../gcc/target-globals.cc:122
    0x1f544cc riscv_save_restore_target_globals(tree_node*)
            .../__RISC-V_BUILD__/../gcc/config/riscv/riscv.cc:9138
    0x1f55c36 riscv_set_current_function
    ...

    There are two reasons for this ICE.
    1. The implied extension(s) of v are not well handled and the
       TARGET_MIN_VLEN is 0 which is not reinitialized.  Then the
       size / TARGET_MIN_VLEN will have DivideByZero.
    2. The machine modes of the vector types will be vary after
       the v extension is introduced.

    This patch passed below testsuite:
    1. The riscv fully regression test.

            PR target/114352

    gcc/ChangeLog:

            * common/config/riscv/riscv-common.cc (riscv_subset_list::parse):
            Replace implied, combine and check to func finalize.
            (riscv_subset_list::finalize): New func impl to take care of
            implied, combine ext and related checks.
            * config/riscv/riscv-subset.h: Add func decl for finalize.
            * config/riscv/riscv-target-attr.cc
(riscv_target_attr_parser::parse_arch):
            Finalize the ext before return succeed.
            * config/riscv/riscv.cc (riscv_set_current_function): Reinit the
            machine mode before when set cur function.

    gcc/testsuite/ChangeLog:

            * gcc.target/riscv/rvv/base/pr114352-1.c: New test.
            * gcc.target/riscv/rvv/base/pr114352-2.c: New test.

    Signed-off-by: Pan Li <pan2.li@intel.com>

  parent reply	other threads:[~2024-03-22  2:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-15  8:25 [Bug c/114352] New: " pan2.li at intel dot com
2024-03-15  8:30 ` [Bug c/114352] " pan2.li at intel dot com
2024-03-15  9:06 ` [Bug target/114352] " rguenth at gcc dot gnu.org
2024-03-22  2:36 ` cvs-commit at gcc dot gnu.org [this message]
2024-03-22  2:39 ` cvs-commit at gcc dot gnu.org
2024-03-22  2:47 ` pan2.li at intel dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-114352-4-8YNRU0GDko@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).