On 8/25/25 2:20 PM, David Faust wrote:
When translating type bit sizes from DWARF, ctf_die_bitsize was
using uint32_t. For extremely large struct types, the bit size may be
larger than 32-bits and hence truncated, which caused incorrect encoding
for these huge structs rather than properly using CTF's large type size
encoding. Switching to uHWI avoids the truncation so these struct types
are properly handled by the existing code.
Tested on x86_64-pc-linux-gnu.
PR debug/121411
gcc/
* dwarf2ctf.cc (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.
The dwarf2ctf.cc change looks fine to me.
I'm a little concerned about the testsuite change. I would expect that
it might fail on 32 bit targets. You probably need to restrict it to
only testing on lp64 targets.
An easy way to do that is with a dg-go line like this:
{ dg-do compile { target lp64 } }
OK with that change.
jeff