On 11/28/25 1:33 PM, Jakub Jelinek wrote:
On Fri, Nov 28, 2025 at 07:23:13PM +0100, Andreas Schwab wrote:
This breaks bootstrap for riscv:

In file included from ../../gcc/rtl.h:4039,
                  from ../../gcc/config/riscv/riscv.cc:33:
../../gcc/config/riscv/riscv.cc: In function 'rtx_def* 
riscv_unspec_address_offset(rtx, rtx, riscv_symbol_type)':
../../gcc/config/riscv/riscv.cc:2817:47: error: arithmetic between different 
enumeration types 'unspec' and 'riscv_symbol_type' is deprecated 
[-Werror=deprecated-enum-enum-conversion]
  2817 |                          UNSPEC_ADDRESS_FIRST + symbol_type);
       |                          ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
./genrtl.h:502:43: note: in definition of macro 'gen_rtx_fmt_Ei'
   502 |   gen_rtx_fmt_Ei_stat ((c), (m), (arg0), (arg1) MEM_STAT_INFO)
       |                                           ^~~~
../../gcc/config/riscv/riscv.cc:2816:10: note: in expansion of macro 
'gen_rtx_UNSPEC'
  2816 |   base = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, base),
       |          ^~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
make[3]: *** [Makefile:2787: riscv.o] Error 1

Indeed.  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 riscv build.
Tested on x86_64 with a cross to riscv, by doing
make clean; make -j32 CXXFLAGS='-g -std=gnu++20' in the gcc/ directory.

Ok for trunk?

2025-11-28  Jakub Jelinek  <[email protected]>

        * config/riscv/riscv-v.cc (expand_const_vector_onestep): Avoid
        bitwise ops between enumerators from different enum types.
        (emit_vec_cvt_x_f): Likewise.
        (emit_vec_cvt_x_f_rtz): Likewise.
        * config/riscv/riscv.cc (riscv_unspec_address_offset): Avoid
        arithmetics between enumerators from different enum types.
OK
jeff

Reply via email to