[Bug target/126484] error: too few argu ments to function ‘unsigned int __builtin_m ips_get_fcsr(void)`

"jakub at gcc dot gnu.org via Gcc-bugs" <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126484

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org,
                   |                            |syq at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The mips backend creates the builtin function type incorrectly.
mips-ftypes.def:      VOID for void_type_node
#define MIPS_ATYPE_VOID void_type_node
and later constructed with:
    types[(int) type]                                                   \
      = build_function_type_list (MIPS_FTYPE_ATYPES##NUM ARGS,          \
                                  NULL_TREE);                           \
The point of () functions is that for
DEF_MIPS_FTYPE (1, (SI, VOID))
DEF_MIPS_FTYPE (1, (USI, VOID))
those actually should be instead using omitting that argument, so that the
argument list is void_list_node.
I'd think e.g.
--- gcc/config/mips/mips-ftypes.def.jj  2026-03-27 10:17:13.895334639 +0100
+++ gcc/config/mips/mips-ftypes.def     2026-07-29 22:46:31.097286998 +0200
@@ -75,7 +75,7 @@ DEF_MIPS_FTYPE (1, (SI, V4QI))
 DEF_MIPS_FTYPE (2, (SI, V4QI, V4QI))
 DEF_MIPS_FTYPE (2, (SI, V4SI, UQI))
 DEF_MIPS_FTYPE (2, (SI, V8HI, UQI))
-DEF_MIPS_FTYPE (1, (SI, VOID))
+DEF_MIPS_FTYPE (0, (SI, VOID))

 DEF_MIPS_FTYPE (2, (UDI, UDI, UDI))
 DEF_MIPS_FTYPE (2, (UDI, UV2SI, UV2SI))
@@ -84,7 +84,7 @@ DEF_MIPS_FTYPE (2, (UDI, V2DI, UQI))
 DEF_MIPS_FTYPE (2, (USI, V16QI, UQI))
 DEF_MIPS_FTYPE (2, (USI, V4SI, UQI))
 DEF_MIPS_FTYPE (2, (USI, V8HI, UQI))
-DEF_MIPS_FTYPE (1, (USI, VOID))
+DEF_MIPS_FTYPE (0, (USI, VOID))

 DEF_MIPS_FTYPE (2, (UV16QI, UV16QI, UQI))
 DEF_MIPS_FTYPE (2, (UV16QI, UV16QI, UV16QI))
--- gcc/config/mips/mips.cc.jj  2026-06-30 09:20:44.087805722 +0200
+++ gcc/config/mips/mips.cc     2026-07-29 22:48:04.576110764 +0200
@@ -211,6 +211,7 @@ enum mips_ucbranch_type
 };

 /* Macros to create an enumeration identifier for a function prototype.  */
+#define MIPS_FTYPE_NAME0(A, B) MIPS_##A##_FTYPE_##B
 #define MIPS_FTYPE_NAME1(A, B) MIPS_##A##_FTYPE_##B
 #define MIPS_FTYPE_NAME2(A, B, C) MIPS_##A##_FTYPE_##B##_##C
 #define MIPS_FTYPE_NAME3(A, B, C, D) MIPS_##A##_FTYPE_##B##_##C##_##D
@@ -17137,6 +17138,9 @@ mips_build_cvpointer_type (void)

 /* MIPS_FTYPE_ATYPESN takes N MIPS_FTYPES-like type codes and lists
    their associated MIPS_ATYPEs.  */
+#define MIPS_FTYPE_ATYPES0(A, B) \
+  MIPS_ATYPE_##A
+
 #define MIPS_FTYPE_ATYPES1(A, B) \
   MIPS_ATYPE_##A, MIPS_ATYPE_##B

perhaps could fix it, but mips isn't a target I've ever tested nor care about
much, so will defer to maintainers.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.