[gcc r16-3889] ctf: Fix struct size truncation in 32-bit hosts [PR121903, PR121411]
David Faust
dfaust@gcc.gnu.org
Mon Sep 15 22:46:59 GMT 2025
https://gcc.gnu.org/g:bace01eeab69cabd0a326174909ced554af85c79
commit r16-3889-gbace01eeab69cabd0a326174909ced554af85c79
Author: David Faust <david.faust@oracle.com>
Date: Mon Sep 15 15:03:31 2025 -0700
ctf: Fix struct size truncation in 32-bit hosts [PR121903,PR121411]
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.
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.
Diff:
---
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 51511d69baa0..221e62e8f45d 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 32c73be6a412..26f35f0ac6f9 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);
More information about the Gcc-cvs
mailing list