LGTM, thanks for the fix...mostly I only test C, C++ and fortran, so I didn't notice that scenarios.
Eric Botcazou <[email protected]> 於 2026年9月21日週一 下午3:58寫道: > > Hi, > > the attached Ada testcase trips on the failure of the assertion present on > line > 6848 in riscv_flatten_aggregate_field: > > n_elts = 1 + tree_to_uhwi (TYPE_MAX_VALUE (index)) > - tree_to_uhwi (TYPE_MIN_VALUE (index)); > gcc_assert (n_elts >= 0); > > The problem is that the computation of the number of elements is performed in > HOST_WIDE_INT, which does not reproduce the wraparound of the 32-bit sizetype > index that happens when the low bound is negative and the high bound is not. > > The correct computation is the one implemented by tree.cc:array_type_nelts_top > but it is done on trees, while using wide-ints is sufficient in this case. > > Tested on riscv32-elf, OK for the mainline? > > > 2026-09-21 Eric Botcazou <[email protected]> > > * config/riscv/riscv.cc (riscv_flatten_aggregate_field) <ARRAY_TYPE>: > Perform the computation of the number of elements using the precision > of the index type instead of using HOST_WIDE_INT. > > > 2026-09-21 Eric Botcazou <[email protected]> > > * gnat.dg/array44.adb: New test. > > > -- > Eric Botcazou
