aboutsummaryrefslogtreecommitdiff
path: root/gcc/dwarf2ctf.cc
diff options
context:
space:
mode:
authorJerry DeLisle <jvdelisle@gcc.gnu.org>2025-09-02 15:58:26 -0700
committerJerry DeLisle <jvdelisle@gcc.gnu.org>2025-09-02 15:58:26 -0700
commit071b4126c613881f4cb25b4e5c39032964827f88 (patch)
tree7ed805786566918630d1d617b1ed8f7310f5fd8e /gcc/dwarf2ctf.cc
parent845d23f3ea08ba873197c275a8857eee7edad996 (diff)
parentcaa1c2f42691d68af4d894a5c3e700ecd2dba080 (diff)
downloadgcc-devel/gfortran-test.zip
gcc-devel/gfortran-test.tar.gz
gcc-devel/gfortran-test.tar.bz2
Merge branch 'master' into gfortran-testdevel/gfortran-test
Diffstat (limited to 'gcc/dwarf2ctf.cc')
-rw-r--r--gcc/dwarf2ctf.cc12
1 files changed, 9 insertions, 3 deletions
diff --git a/gcc/dwarf2ctf.cc b/gcc/dwarf2ctf.cc
index 7de3696..f8b305b 100644
--- a/gcc/dwarf2ctf.cc
+++ b/gcc/dwarf2ctf.cc
@@ -361,7 +361,7 @@ gen_ctf_subrange_type (ctf_container_ref ctfc, ctf_dtdef_ref array_elems_type,
dw_attr_node *upper_bound_at;
dw_die_ref array_index_type;
- uint32_t array_num_elements;
+ unsigned HOST_WIDE_INT array_num_elements;
if (dw_get_die_tag (c) == DW_TAG_subrange_type)
{
@@ -376,9 +376,9 @@ gen_ctf_subrange_type (ctf_container_ref ctfc, ctf_dtdef_ref array_elems_type,
if (upper_bound_at
&& AT_class (upper_bound_at) == dw_val_class_unsigned_const)
/* This is the upper bound index. */
- array_num_elements = get_AT_unsigned (c, DW_AT_upper_bound) + 1;
+ array_num_elements = AT_unsigned (get_AT (c, DW_AT_upper_bound)) + 1;
else if (get_AT (c, DW_AT_count))
- array_num_elements = get_AT_unsigned (c, DW_AT_count);
+ array_num_elements = AT_unsigned (get_AT (c, DW_AT_count));
else
{
/* This is a VLA of some kind. */
@@ -388,6 +388,12 @@ gen_ctf_subrange_type (ctf_container_ref ctfc, ctf_dtdef_ref array_elems_type,
else
gcc_unreachable ();
+ if (array_num_elements > UINT32_MAX)
+ {
+ /* The array cannot be encoded in CTF. TBD_CTF_REPRESENTATION_LIMIT. */
+ return gen_ctf_unknown_type (ctfc);
+ }
+
/* Ok, mount and register the array type. Note how the array
type we register here is the type of the elements in
subsequent "dimensions", if there are any. */