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

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

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

commit r14-8834-gdb5c3f6d952bc3950d23c0a6be4e8ec9147ef752
Author: Pan Li <pan2...@intel.com>
Date:   Tue Feb 6 15:35:02 2024 +0800

    RISC-V: Bugfix for RVV overloaded intrinisc ICE when empty args

    There is one corn case when similar as below example:

    void test (void)
    {
      __riscv_vfredosum_tu ();
    }

    It will meet ICE because of the implement details of overloaded function
    in gcc.  According to the rvv intrinisc doc, we have no such overloaded
    function with empty args.  Unfortunately, we register the empty args
    function as overloaded for avoiding conflict.  Thus, there will be actual
    one register function after return NULL_TREE back to the middle-end,
    and finally result in ICE when expanding.  For example:

    1. First we registered void __riscv_vfredmax () as the overloaded function.
    2. Then resolve_overloaded_builtin (this func) return NULL_TREE.
    3. The functions register in step 1 bypass the args check as empty args.
    4. Finally, fall into expand_builtin with empty args and meet ICE.

    Here we report error when overloaded function with empty args.  For
example:

    test.c: In function 'foo':
    test.c:8:3: error: no matching function call to '__riscv_vfredosum_tu' with
empty args
        8 |   __riscv_vfredosum_tu();
          |   ^~~~~~~~~~~~~~~~~~~~

    Below test are passed for this patch.

    * The riscv regression tests.

            PR target/113766

    gcc/ChangeLog:

            * config/riscv/riscv-protos.h (resolve_overloaded_builtin): Adjust
            the signature of func.
            * config/riscv/riscv-c.cc (riscv_resolve_overloaded_builtin):
Ditto.
            * config/riscv/riscv-vector-builtins.cc
(resolve_overloaded_builtin): Make
            overloaded func with empty args error.

    gcc/testsuite/ChangeLog:

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

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

Reply via email to