aboutsummaryrefslogtreecommitdiff
path: root/gcc/dwarf2out.c
diff options
context:
space:
mode:
authorPierre-Marie de Rodat <derodat@adacore.com>2015-12-17 14:10:12 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2015-12-17 14:10:12 +0000
commit98088266e55b9c34ff9b0852fa9a7c559594cdcd (patch)
tree147811576da6971191a0556e3c237b728b185cf6 /gcc/dwarf2out.c
parent24bd3c6e80acc80f02d5016cf192a702553ae673 (diff)
downloadgcc-98088266e55b9c34ff9b0852fa9a7c559594cdcd.zip
gcc-98088266e55b9c34ff9b0852fa9a7c559594cdcd.tar.gz
gcc-98088266e55b9c34ff9b0852fa9a7c559594cdcd.tar.bz2
DWARF: create a macro for max dimensions for array descr. lang. hook
The array descriptor language hook can hold the description of a limited number of array dimensions. This macro will ease preventing overflow in front-ends. gcc/ada/ChangeLog: * gcc-interface/misc.c (gnat_get_array_descr_info): When the array has more dimensions than the language hook can handle, fall back to a nested arrays description. Handle context-less array types. gcc/ChangeLog: * dwarf2out.h (DWARF2OUT_ARRAY_DESCR_INFO_MAX_DIMEN): New macro. (struct array_descr_info): Use it for the dimensions array's size. * dwarf2out.c (gen_type_die_with_usage): Check that the array descr. language hook does not return an array with more dimensions that it should. From-SVN: r231766
Diffstat (limited to 'gcc/dwarf2out.c')
-rw-r--r--gcc/dwarf2out.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 538b76d..98528c7 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -22563,6 +22563,10 @@ gen_type_die_with_usage (tree type, dw_die_ref context_die,
memset (&info, 0, sizeof (info));
if (lang_hooks.types.get_array_descr_info (type, &info))
{
+ /* Fortran sometimes emits array types with no dimension. */
+ gcc_assert (info.ndimensions >= 0
+ && (info.ndimensions
+ <= DWARF2OUT_ARRAY_DESCR_INFO_MAX_DIMEN));
gen_descr_array_type_die (type, &info, context_die);
TREE_ASM_WRITTEN (type) = 1;
return;