https://gcc.gnu.org/g:9514e082960a01ec1658f056f95b7247d7671079

commit r16-5694-g9514e082960a01ec1658f056f95b7247d7671079
Author: Stefan Schulze Frielinghaus <[email protected]>
Date:   Fri Nov 28 13:45:45 2025 +0100

    s390: Fix deprecated-enum-enum-conversion warnings
    
    With the recent switch in commit r16-5628 defaulting to C++20 some
    enumeration arithmetic errors are thrown during bootstrap, now.  Fixed
    by casting those to type int.  I'm using type int here merely because
    S390_ALL_BUILTIN_MAX is used in comparisons with other operands of type
    int.
    
    gcc/ChangeLog:
    
            * config/s390/s390-builtins.h
            (S390_OVERLOADED_BUILTIN_VAR_OFFSET,S390_ALL_BUILTIN_MAX): Fix
            enum arithmetic.
            * config/s390/s390.cc (OB_DEF): Ditto.

Diff:
---
 gcc/config/s390/s390-builtins.h | 12 +++++-------
 gcc/config/s390/s390.cc         | 10 ++++------
 2 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/gcc/config/s390/s390-builtins.h b/gcc/config/s390/s390-builtins.h
index e19fc7eec51b..1e596aef7ce4 100644
--- a/gcc/config/s390/s390-builtins.h
+++ b/gcc/config/s390/s390-builtins.h
@@ -134,10 +134,10 @@ S390_OVERLOADED_BUILTIN_VAR_MAX
 
 #define S390_OVERLOADED_BUILTIN_OFFSET S390_BUILTIN_MAX
 #define S390_OVERLOADED_BUILTIN_VAR_OFFSET \
-  (S390_BUILTIN_MAX + S390_OVERLOADED_BUILTIN_MAX)
-#define S390_ALL_BUILTIN_MAX                           \
-  (S390_BUILTIN_MAX + S390_OVERLOADED_BUILTIN_MAX +    \
-   S390_OVERLOADED_BUILTIN_VAR_MAX)
+  ((int)S390_BUILTIN_MAX + (int)S390_OVERLOADED_BUILTIN_MAX)
+#define S390_ALL_BUILTIN_MAX                                   \
+  ((int)S390_BUILTIN_MAX + (int)S390_OVERLOADED_BUILTIN_MAX +  \
+   (int)S390_OVERLOADED_BUILTIN_VAR_MAX)
 
 extern const unsigned int bflags_builtin[S390_BUILTIN_MAX + 1];
 extern const unsigned int opflags_builtin[S390_BUILTIN_MAX + 1];
@@ -172,6 +172,4 @@ opflags_for_builtin (int fcode)
     return opflags_builtin[fcode];
 }
 
-extern GTY(()) tree s390_builtin_decls[S390_BUILTIN_MAX +
-                                      S390_OVERLOADED_BUILTIN_MAX +
-                                      S390_OVERLOADED_BUILTIN_VAR_MAX];
+extern GTY(()) tree s390_builtin_decls[S390_ALL_BUILTIN_MAX];
diff --git a/gcc/config/s390/s390.cc b/gcc/config/s390/s390.cc
index d65109026f2a..359ea1c3d64b 100644
--- a/gcc/config/s390/s390.cc
+++ b/gcc/config/s390/s390.cc
@@ -686,9 +686,7 @@ 
opflags_overloaded_builtin_var[S390_OVERLOADED_BUILTIN_VAR_MAX + 1] =
 
 tree s390_builtin_types[BT_MAX];
 tree s390_builtin_fn_types[BT_FN_MAX];
-tree s390_builtin_decls[S390_BUILTIN_MAX +
-                       S390_OVERLOADED_BUILTIN_MAX +
-                       S390_OVERLOADED_BUILTIN_VAR_MAX];
+tree s390_builtin_decls[S390_ALL_BUILTIN_MAX];
 
 static enum insn_code const code_for_builtin[S390_BUILTIN_MAX + 1] = {
 #undef B_DEF
@@ -771,12 +769,12 @@ s390_init_builtins (void)
                            ATTRS);
 #undef OB_DEF
 #define OB_DEF(NAME, FIRST_VAR_NAME, LAST_VAR_NAME, BFLAGS, FNTYPE)    \
-  if (s390_builtin_decls[S390_OVERLOADED_BUILTIN_##NAME + S390_BUILTIN_MAX] \
+  if (s390_builtin_decls[(int)S390_OVERLOADED_BUILTIN_##NAME + 
(int)S390_BUILTIN_MAX] \
       == NULL)                                                         \
-    s390_builtin_decls[S390_OVERLOADED_BUILTIN_##NAME + S390_BUILTIN_MAX] = \
+    s390_builtin_decls[(int)S390_OVERLOADED_BUILTIN_##NAME + 
(int)S390_BUILTIN_MAX] = \
       add_builtin_function ("__builtin_" #NAME,                                
\
                            s390_builtin_fn_types[FNTYPE],              \
-                           S390_OVERLOADED_BUILTIN_##NAME + S390_BUILTIN_MAX, \
+                           (int)S390_OVERLOADED_BUILTIN_##NAME + 
(int)S390_BUILTIN_MAX, \
                            BUILT_IN_MD,                                \
                            NULL,                                       \
                            0);

Reply via email to