https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121411
--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by David Faust <[email protected]>: https://gcc.gnu.org/g:c77d79785d32b30502c8bcd6aa53b63d715bb124 commit r16-3379-gc77d79785d32b30502c8bcd6aa53b63d715bb124 Author: David Faust <[email protected]> Date: Wed Aug 6 09:24:40 2025 -0700 ctf: avoid overflow for array num elements [PR121411] CTF array encoding uses uint32 for number of elements. This means there is a hard upper limit on array types which the format can represent. GCC internally was also using a uint32_t for this, which would overflow when translating from DWARF for arrays with more than UINT32_MAX elements. Use an unsigned HOST_WIDE_INT instead to fetch the array bound, and fall back to CTF_K_UNKNOWN if the array cannot be represented in CTF. PR debug/121411 gcc/ * dwarf2ctf.cc (gen_ctf_subrange_type): Use unsigned HWI for array_num_elements. Fallback to CTF_K_UNKNOWN if the array type has too many elements for CTF to represent. gcc/testsuite/ * gcc.dg/debug/ctf/ctf-array-7.c: New test.
