The 'size' argument of ctf_add_sou was size_t. After the prior fixes for PR121411, this could cause the struct size to be truncated when encoding extremely large structs on a host where size_t is smaller than unsigned HOST_WIDE_INT, manifesting for example as the test failure reported in PR121903. Change the argument to uHWI to resolve the issue.
Tested on ARMv7 host for x86_64-linux-gnu target. Also checked on x86_64-pc-linux-gnu. Committed as obvious. PR debug/121411 PR debug/121903 gcc/ * ctfc.h (ctf_add_sou): Change size arg from size_t to uHWI. * ctfc.cc (ctf_add_sou): Likewise. --- gcc/ctfc.cc | 2 +- gcc/ctfc.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gcc/ctfc.cc b/gcc/ctfc.cc index 51511d69baa..221e62e8f45 100644 --- a/gcc/ctfc.cc +++ b/gcc/ctfc.cc @@ -798,7 +798,7 @@ ctf_add_function (ctf_container_ref ctfc, uint32_t flag, const char * name, ctf_dtdef_ref ctf_add_sou (ctf_container_ref ctfc, uint32_t flag, const char * name, - uint32_t kind, size_t size, dw_die_ref die) + uint32_t kind, unsigned HOST_WIDE_INT size, dw_die_ref die) { ctf_dtdef_ref dtd; diff --git a/gcc/ctfc.h b/gcc/ctfc.h index 32c73be6a41..26f35f0ac6f 100644 --- a/gcc/ctfc.h +++ b/gcc/ctfc.h @@ -439,7 +439,7 @@ extern ctf_dtdef_ref ctf_add_function (ctf_container_ref, uint32_t, const char *, const ctf_funcinfo_t *, dw_die_ref, bool, int); extern ctf_dtdef_ref ctf_add_sou (ctf_container_ref, uint32_t, const char *, - uint32_t, size_t, dw_die_ref); + uint32_t, unsigned HOST_WIDE_INT, dw_die_ref); extern int ctf_add_enumerator (ctf_container_ref, ctf_dtdef_ref, const char *, HOST_WIDE_INT, dw_die_ref); -- 2.51.0