]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
loongarch: LoongArch backend, meet C++20
authorJakub Jelinek <jakub@redhat.com>
Fri, 28 Nov 2025 21:04:57 +0000 (22:04 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 28 Nov 2025 21:04:57 +0000 (22:04 +0100)
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  <jakub@redhat.com>

* config/loongarch/loongarch.cc (loongarch_unspec_address_offset):
Avoid arithmetics between enumerators from different enum types.
(loongarch_call_tls_get_addr): Likewise.

gcc/config/loongarch/loongarch.cc

index c1a53e3e7ca0f0d931222aee8cfd84df66c86704..053f77cb994a443178f7b2bf2492046dfb7f06e0 100644 (file)
@@ -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