From: Jakub Jelinek Date: Fri, 28 Nov 2025 21:04:57 +0000 (+0100) Subject: loongarch: LoongArch backend, meet C++20 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e7de6ffc2dad50e99452127fc3875e248fa01766;p=thirdparty%2Fgcc.git 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 * config/loongarch/loongarch.cc (loongarch_unspec_address_offset): Avoid arithmetics between enumerators from different enum types. (loongarch_call_tls_get_addr): Likewise. --- diff --git a/gcc/config/loongarch/loongarch.cc b/gcc/config/loongarch/loongarch.cc index c1a53e3e7ca..053f77cb994 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