Hi!

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, will commit the following patch once sourceware is fully back.
Jeff has preapproved similar patches.

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.

--- gcc/analyzer/known-function-manager.cc.jj   2025-06-30 22:16:34.686387520 
+0200
+++ gcc/analyzer/known-function-manager.cc      2025-11-28 21:10:05.113560868 
+0100
@@ -83,8 +83,8 @@ known_function_manager::add (enum intern
                             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.

        Jakub

Reply via email to