https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121411
--- Comment #14 from Martin Pirker <martin.pirker1 at chello dot at> --- (In reply to GCC Commits from comment #12) > The master branch has been updated by David Faust <[email protected]>: > > https://gcc.gnu.org/g:50efa788a4b6c7f619101b6156b47b91124c6dd3 > > commit r16-3723-g50efa788a4b6c7f619101b6156b47b91124c6dd3 > Author: David Faust <[email protected]> > Date: Thu Aug 28 09:12:55 2025 -0700 > > ctf: fix integer truncations in very large structs [PR121411] > > DWARF to CTF translation for type bit sizes was using uint32_t, and for > member offsets was inadvertently using unsigned int via get_AT_unsigned. > For very large struct types, at least one of these could be truncated > causing incorrect encoding of the struct type and member offsets. > > Use HOST_WIDE_INT to avoid these truncation issues and fix the encoding > for large structs. > > PR debug/121411 > > gcc/ > > * dwarf2ctf.cc (ctf_get_AT_data_member_location) Use AT_unsigned > when fetching AT_bit_offset and AT_data_member_location. > Simplify. > (ctf_die_bitsize): Return unsigned HOST_WIDE_INT instead of > uint32_t. > (gen_ctf_base_type, gen_ctf_sou_type, gen_ctf_enumeration_type): > Adapt accordingly. > > gcc/testsuite/ > > * gcc.dg/debug/ctf/ctf-struct-3.c: New test. I think we also need a testcase for struct size in bytes: ctt_size >= CTF_LSTRUCT_THRESH ctt_size <= CTF_MAX_SIZE i.e struct header in ctf_stype_t, without ctt_lsizehi/ctt_lsizelo
