https://gcc.gnu.org/g:e7de6ffc2dad50e99452127fc3875e248fa01766

commit r16-5701-ge7de6ffc2dad50e99452127fc3875e248fa01766
Author: Jakub Jelinek <[email protected]>
Date:   Fri Nov 28 22:04:57 2025 +0100

    loongarch: LoongArch 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 loongarch build.
    
    2025-11-28  Jakub Jelinek  <[email protected]>
    
            * config/loongarch/loongarch.cc (loongarch_unspec_address_offset):
            Avoid arithmetics between enumerators from different enum types.
            (loongarch_call_tls_get_addr): Likewise.

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

diff --git a/gcc/config/loongarch/loongarch.cc 
b/gcc/config/loongarch/loongarch.cc
index c1a53e3e7ca0..053f77cb994a 100644
--- a/gcc/config/loongarch/loongarch.cc
+++ b/gcc/config/loongarch/loongarch.cc
@@ -3003,7 +3003,7 @@ loongarch_unspec_address_offset (rtx base, rtx offset,
                                 enum loongarch_symbol_type symbol_type)
 {
   base = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, base),
-                        UNSPEC_ADDRESS_FIRST + symbol_type);
+                        UNSPEC_ADDRESS_FIRST + (int) symbol_type);
   if (offset != const0_rtx)
     base = gen_rtx_PLUS (Pmode, base, offset);
   return gen_rtx_CONST (Pmode, base);
@@ -3223,7 +3223,7 @@ loongarch_call_tls_get_addr (rtx sym, enum 
loongarch_symbol_type type, rtx v0)
                  rtx sum = gen_rtx_UNSPEC (
                    Pmode, gen_rtvec (1, loongarch_tls_symbol),
                    UNSPEC_ADDRESS_FIRST
-                   + loongarch_classify_symbol (loongarch_tls_symbol));
+                   + (int) loongarch_classify_symbol (loongarch_tls_symbol));
                  set_unique_reg_note (get_last_insn (), REG_EQUAL, sum);
                }
              else

Reply via email to