https://gcc.gnu.org/g:4eca016d56d7c5ac1ceafe0afb8112f0f72f1957

commit r16-5703-g4eca016d56d7c5ac1ceafe0afb8112f0f72f1957
Author: Jakub Jelinek <[email protected]>
Date:   Fri Nov 28 22:06:30 2025 +0100

    analyzer: Fix 3 C++20 warnings in analyzer
    
    I've noticed
    ../../gcc/analyzer/known-function-manager.cc:86:33: warning: arithmetic 
between different enumeration types ‘internal_fn’ and ‘built_in_function’ is 
deprecated
    +[-Wdeprecated-enum-enum-conversion]
    ../../gcc/analyzer/known-function-manager.cc:87:26: warning: arithmetic 
between different enumeration types ‘internal_fn’ and ‘built_in_function’ is 
deprecated
    +[-Wdeprecated-enum-enum-conversion]
    ../../gcc/analyzer/known-function-manager.cc:140:33: warning: arithmetic 
between different enumeration types ‘internal_fn’ and ‘built_in_function’ is 
deprecated
    +[-Wdeprecated-enum-enum-conversion]
    warnings.  Fixed thusly.
    
    2025-11-28  Jakub Jelinek  <[email protected]>
    
            * known-function-manager.cc (known_function_manager::add): Avoid
            arithmetics between enumerators from different enum types.
            (known_function_manager::get_internal_fn): Likewise.

Diff:
---
 gcc/analyzer/known-function-manager.cc | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gcc/analyzer/known-function-manager.cc 
b/gcc/analyzer/known-function-manager.cc
index 3b645a8c90f8..fad34ad38b0f 100644
--- a/gcc/analyzer/known-function-manager.cc
+++ b/gcc/analyzer/known-function-manager.cc
@@ -83,8 +83,8 @@ known_function_manager::add (enum internal_fn ifn,
                             std::unique_ptr<known_function> kf)
 {
   gcc_assert (ifn < IFN_LAST);
-  delete m_combined_fns_arr[ifn + END_BUILTINS];
-  m_combined_fns_arr[ifn + END_BUILTINS] = kf.release ();
+  delete m_combined_fns_arr[ifn + int (END_BUILTINS)];
+  m_combined_fns_arr[ifn + int (END_BUILTINS)] = kf.release ();
 }
 
 /* Get any known_function for FNDECL for call CD.
@@ -137,7 +137,7 @@ const known_function *
 known_function_manager::get_internal_fn (enum internal_fn ifn) const
 {
   gcc_assert (ifn < IFN_LAST);
-  return m_combined_fns_arr[ifn + END_BUILTINS];
+  return m_combined_fns_arr[ifn + int (END_BUILTINS)];
 }
 
 /* Get any known_function for NAME, without type-checking.

Reply via email to