https://gcc.gnu.org/g:36053843658f349bf645484b9dacd6f41a156d5e

commit r16-5702-g36053843658f349bf645484b9dacd6f41a156d5e
Author: Jakub Jelinek <[email protected]>
Date:   Fri Nov 28 22:05:34 2025 +0100

    powerpc: PowerPC backend, meet C++20
    
    C++20, in particular https://wg21.link/P1120R0 paper voted into it,
    deprecates various operations between enumerators from different enumeration
    types etc., and as we've switched to -std=gnu++20 by default, this now
    results in warnings or errors during stage2 and onwards.
    
    The following patch should fix rs6000 build.
    
    2025-11-28  Jakub Jelinek  <[email protected]>
    
            * config/rs6000/rs6000.cc (complex_multiply_builtin_code):
            Avoid arithmetics between enumerators from different enum types.
            (complex_divide_builtin_code): Likewise.

Diff:
---
 gcc/config/rs6000/rs6000.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc
index 1d5cd25c0f08..bf899adc5315 100644
--- a/gcc/config/rs6000/rs6000.cc
+++ b/gcc/config/rs6000/rs6000.cc
@@ -28490,7 +28490,7 @@ static inline built_in_function
 complex_multiply_builtin_code (machine_mode mode)
 {
   gcc_assert (IN_RANGE (mode, MIN_MODE_COMPLEX_FLOAT, MAX_MODE_COMPLEX_FLOAT));
-  int func = BUILT_IN_COMPLEX_MUL_MIN + mode - MIN_MODE_COMPLEX_FLOAT;
+  int func = BUILT_IN_COMPLEX_MUL_MIN + (mode - MIN_MODE_COMPLEX_FLOAT);
   return (built_in_function) func;
 }
 
@@ -28501,7 +28501,7 @@ static inline built_in_function
 complex_divide_builtin_code (machine_mode mode)
 {
   gcc_assert (IN_RANGE (mode, MIN_MODE_COMPLEX_FLOAT, MAX_MODE_COMPLEX_FLOAT));
-  int func = BUILT_IN_COMPLEX_DIV_MIN + mode - MIN_MODE_COMPLEX_FLOAT;
+  int func = BUILT_IN_COMPLEX_DIV_MIN + (mode - MIN_MODE_COMPLEX_FLOAT);
   return (built_in_function) func;
 }

Reply via email to