From 98088266e55b9c34ff9b0852fa9a7c559594cdcd Mon Sep 17 00:00:00 2001 From: Pierre-Marie de Rodat Date: Thu, 17 Dec 2015 14:10:12 +0000 Subject: 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 --- gcc/dwarf2out.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'gcc/dwarf2out.h') diff --git a/gcc/dwarf2out.h b/gcc/dwarf2out.h index 9173076..24a384c 100644 --- a/gcc/dwarf2out.h +++ b/gcc/dwarf2out.h @@ -316,6 +316,8 @@ enum array_descr_ordering array_descr_ordering_column_major }; +#define DWARF2OUT_ARRAY_DESCR_INFO_MAX_DIMEN 16 + struct array_descr_info { int ndimensions; @@ -339,7 +341,7 @@ struct array_descr_info /* Only Fortran uses more than one dimension for array types. For other languages, the stride can be rather specified for the whole array. */ tree stride; - } dimen[10]; + } dimen[DWARF2OUT_ARRAY_DESCR_INFO_MAX_DIMEN]; }; enum fixed_point_scale_factor -- cgit v1.1