diff --git a/gdb/NEWS b/gdb/NEWS
--- a/gdb/NEWS
+++ b/gdb/NEWS
-@@ -335,6 +335,8 @@ SH-5/SH64 running OpenBSD SH-5/SH64 support in sh*-*-openbsd*
+@@ -805,6 +805,8 @@ SH-5/SH64 running OpenBSD SH-5/SH64 support in sh*-*-openbsd*
*** Changes in GDB 8.1
diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c
--- a/gdb/c-valprint.c
+++ b/gdb/c-valprint.c
-@@ -653,6 +653,28 @@ c_value_print (struct value *val, struct ui_file *stream,
+@@ -649,6 +649,28 @@ c_value_print (struct value *val, struct ui_file *stream,
else
{
/* normal case */
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
-@@ -1833,7 +1833,8 @@ static void read_signatured_type (struct signatured_type *);
+@@ -1827,7 +1827,10 @@ static void read_signatured_type (struct signatured_type *);
static int attr_to_dynamic_prop (const struct attribute *attr,
struct die_info *die, struct dwarf2_cu *cu,
-- struct dynamic_prop *prop);
-+ struct dynamic_prop *prop, const gdb_byte *additional_data,
+- struct dynamic_prop *prop, struct type *type);
++ struct dynamic_prop *prop,
++ struct type *default_type,
++ const gdb_byte *additional_data,
+ int additional_data_size);
/* memory allocation interface */
-@@ -13757,7 +13758,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
- {
+@@ -13799,7 +13802,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
newobj->static_link
= XOBNEW (&objfile->objfile_obstack, struct dynamic_prop);
-- attr_to_dynamic_prop (attr, die, cu, newobj->static_link);
-+ attr_to_dynamic_prop (attr, die, cu, newobj->static_link, NULL, 0);
+ attr_to_dynamic_prop (attr, die, cu, newobj->static_link,
+- dwarf2_per_cu_addr_type (cu->per_cu));
++ dwarf2_per_cu_addr_type (cu->per_cu), NULL, 0);
}
cu->list_in_scope = cu->get_builder ()->get_local_symbols ();
-@@ -16495,7 +16496,8 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu)
-
+@@ -16565,7 +16568,7 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu)
byte_stride_prop
= (struct dynamic_prop *) alloca (sizeof (struct dynamic_prop));
-- stride_ok = attr_to_dynamic_prop (attr, die, cu, byte_stride_prop);
-+ stride_ok = attr_to_dynamic_prop (attr, die, cu, byte_stride_prop,
-+ NULL, 0);
+ stride_ok = attr_to_dynamic_prop (attr, die, cu, byte_stride_prop,
+- prop_type);
++ prop_type, NULL, 0);
if (!stride_ok)
{
complaint (_("unable to read array DW_AT_byte_stride "
-@@ -17256,29 +17258,90 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu)
- struct gdbarch *gdbarch = get_objfile_arch (objfile);
- struct type *type, *range_type, *index_type, *char_type;
+@@ -17325,7 +17328,7 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu)
struct attribute *attr;
-- unsigned int length;
-+ unsigned int length = UINT_MAX;
-+
+ struct dynamic_prop prop;
+ bool length_is_constant = true;
+- LONGEST length;
++ ULONGEST length = UINT_MAX;
+
+ /* There are a couple of places where bit sizes might be made use of
+ when parsing a DW_TAG_string_type, however, no producer that we know
+@@ -17346,6 +17349,10 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu)
+ }
+ }
+
+ index_type = objfile_type (objfile)->builtin_int;
+ range_type = create_static_range_type (NULL, index_type, 1, length);
-
++
+ /* If DW_AT_string_length is defined, the length is stored in memory. */
attr = dwarf2_attr (die, DW_AT_string_length, cu);
- if (attr)
+ if (attr != nullptr && !attr_form_is_constant (attr))
+ {
+@@ -17372,13 +17379,71 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu)
+ }
+
+ /* Convert the attribute into a dynamic property. */
+- if (!attr_to_dynamic_prop (attr, die, cu, &prop, prop_type))
++ if (!attr_to_dynamic_prop (attr, die, cu, &prop, prop_type, NULL, 0))
+ length = 1;
+ else
+ length_is_constant = false;
+ }
+ else if (attr != nullptr)
{
-- length = DW_UNSND (attr);
+ if (attr_form_is_block (attr))
+ {
+ struct attribute *byte_size, *bit_size;
+ /* Operand for DW_OP_deref_size. */
+ (gdb_byte) DW_UNSND(byte_size) };
+
-+ if (!attr_to_dynamic_prop (attr, die, cu, &high, append_ops,
-+ ARRAY_SIZE(append_ops)))
++ if (!attr_to_dynamic_prop (attr, die, cu, &high, index_type,
++ append_ops, ARRAY_SIZE(append_ops)))
+ complaint (_("Could not parse DW_AT_byte_size"));
+ }
+ else if (bit_size != NULL)
+ const gdb_byte append_ops[] =
+ { DW_OP_deref };
+
-+ if (!attr_to_dynamic_prop (attr, die, cu, &high, append_ops,
-+ ARRAY_SIZE(append_ops)))
++ if (!attr_to_dynamic_prop (attr, die, cu, &high, index_type,
++ append_ops, ARRAY_SIZE(append_ops)))
+ complaint (_("Could not parse DW_AT_string_length"));
+ }
+
+ TYPE_HIGH_BOUND (range_type) = DW_UNSND(attr);
+ TYPE_HIGH_BOUND_KIND (range_type) = PROP_CONST;
+ }
++
+ /* This DW_AT_string_length just contains the length with no
+ indirection. There's no need to create a dynamic property in this
+ case. Pass 0 for the default value as we know it will not be
+@@ -17392,6 +17457,20 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu)
}
else
{
-- /* Check for the DW_AT_byte_size attribute. */
+ /* Check for the DW_AT_byte_size attribute, which represents the length
+ in this case. */
- attr = dwarf2_attr (die, DW_AT_byte_size, cu);
- if (attr)
-- {
-- length = DW_UNSND (attr);
-- }
++ attr = dwarf2_attr (die, DW_AT_byte_size, cu);
++ if (attr)
+ {
+ TYPE_HIGH_BOUND (range_type) = DW_UNSND(attr);
+ TYPE_HIGH_BOUND_KIND (range_type) = PROP_CONST;
+ }
- else
-- {
-- length = 1;
-- }
++ else
+ {
+ TYPE_HIGH_BOUND (range_type) = 1;
+ TYPE_HIGH_BOUND_KIND (range_type) = PROP_CONST;
+ }
++
+ /* Use 1 as a fallback length if we have nothing else. */
+ length = 1;
}
-
-- index_type = objfile_type (objfile)->builtin_int;
-- range_type = create_static_range_type (NULL, index_type, 1, length);
+@@ -17407,6 +17486,7 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu)
+ low_bound.data.const_val = 1;
+ range_type = create_range_type (NULL, index_type, &low_bound, &prop, 0);
+ }
++
char_type = language_string_char_type (cu->language_defn, gdbarch);
type = create_string_type (NULL, char_type, range_type);
-@@ -17646,7 +17709,8 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu)
-
+@@ -17858,7 +17938,8 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu)
static int
attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die,
-- struct dwarf2_cu *cu, struct dynamic_prop *prop)
-+ struct dwarf2_cu *cu, struct dynamic_prop *prop,
+ struct dwarf2_cu *cu, struct dynamic_prop *prop,
+- struct type *default_type)
++ struct type *default_type,
+ const gdb_byte *additional_data, int additional_data_size)
{
struct dwarf2_property_baton *baton;
struct obstack *obstack
-@@ -17657,14 +17721,33 @@ attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die,
-
- if (attr_form_is_block (attr))
- {
-- baton = XOBNEW (obstack, struct dwarf2_property_baton);
-+ baton = XOBNEW(obstack, struct dwarf2_property_baton);
- baton->referenced_type = NULL;
- baton->locexpr.per_cu = cu->per_cu;
-- baton->locexpr.size = DW_BLOCK (attr)->size;
-- baton->locexpr.data = DW_BLOCK (attr)->data;
+@@ -17885,9 +17966,30 @@ attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die,
+ baton->locexpr.is_reference = false;
+ break;
+ }
+
+ if (additional_data != NULL && additional_data_size > 0)
+ {
}
else if (attr_form_is_ref (attr))
{
-@@ -17697,8 +17780,28 @@ attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die,
+@@ -17920,9 +18022,29 @@ attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die,
baton = XOBNEW (obstack, struct dwarf2_property_baton);
- baton->referenced_type = die_type (target_die, target_cu);
+ baton->property_type = die_type (target_die, target_cu);
baton->locexpr.per_cu = cu->per_cu;
- baton->locexpr.size = DW_BLOCK (target_attr)->size;
- baton->locexpr.data = DW_BLOCK (target_attr)->data;
+ baton->locexpr.is_reference = true;
+
+ if (additional_data != NULL && additional_data_size > 0)
+ {
prop->data.baton = baton;
prop->kind = PROP_LOCEXPR;
gdb_assert (prop->data.baton != NULL);
-@@ -17809,7 +17912,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
-
- attr = dwarf2_attr (die, DW_AT_byte_stride, cu);
- if (attr)
-- if (!attr_to_dynamic_prop (attr, die, cu, &stride))
-+ if (!attr_to_dynamic_prop (attr, die, cu, &stride, NULL, 0))
- complaint (_("Missing DW_AT_byte_stride "
- "- DIE at 0x%s [in module %s]"),
- sect_offset_str (die->sect_off),
-@@ -17817,7 +17920,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
+@@ -18099,8 +18221,8 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
+ }
attr = dwarf2_attr (die, DW_AT_lower_bound, cu);
- if (attr)
-- attr_to_dynamic_prop (attr, die, cu, &low);
-+ attr_to_dynamic_prop (attr, die, cu, &low, NULL, 0);
+- if (attr != nullptr)
+- attr_to_dynamic_prop (attr, die, cu, &low, base_type);
++ if (attr)
++ attr_to_dynamic_prop (attr, die, cu, &low, base_type, NULL, 0);
else if (!low_default_is_valid)
complaint (_("Missing DW_AT_lower_bound "
"- DIE at %s [in module %s]"),
-@@ -17826,10 +17929,10 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
+@@ -18109,10 +18231,10 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
struct attribute *attr_ub, *attr_count;
attr = attr_ub = dwarf2_attr (die, DW_AT_upper_bound, cu);
-- if (!attr_to_dynamic_prop (attr, die, cu, &high))
-+ if (!attr_to_dynamic_prop (attr, die, cu, &high, NULL, 0))
+- if (!attr_to_dynamic_prop (attr, die, cu, &high, base_type))
++ if (!attr_to_dynamic_prop (attr, die, cu, &high, base_type, NULL, 0))
{
attr = attr_count = dwarf2_attr (die, DW_AT_count, cu);
-- if (attr_to_dynamic_prop (attr, die, cu, &high))
-+ if (attr_to_dynamic_prop (attr, die, cu, &high, NULL, 0))
+- if (attr_to_dynamic_prop (attr, die, cu, &high, base_type))
++ if (attr_to_dynamic_prop (attr, die, cu, &high, base_type, NULL, 0))
{
/* If bounds are constant do the final calculation here. */
if (low.kind == PROP_CONST && high.kind == PROP_CONST)
-@@ -25396,7 +25499,7 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
- attr = dwarf2_attr (die, DW_AT_allocated, cu);
- if (attr_form_is_block (attr))
+@@ -18164,7 +18286,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
+ struct type *prop_type
+ = dwarf2_per_cu_addr_sized_int_type (cu->per_cu, false);
+ attr_to_dynamic_prop (attr_byte_stride, die, cu, &byte_stride_prop,
+- prop_type);
++ prop_type, NULL, 0);
+ }
+
+ struct dynamic_prop bit_stride_prop;
+@@ -18185,7 +18307,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
+ struct type *prop_type
+ = dwarf2_per_cu_addr_sized_int_type (cu->per_cu, false);
+ attr_to_dynamic_prop (attr_bit_stride, die, cu, &bit_stride_prop,
+- prop_type);
++ prop_type, NULL, 0);
+ }
+ }
+
+@@ -25879,7 +26001,7 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
{
-- if (attr_to_dynamic_prop (attr, die, cu, &prop))
-+ if (attr_to_dynamic_prop (attr, die, cu, &prop, NULL, 0))
+ struct type *prop_type
+ = dwarf2_per_cu_addr_sized_int_type (cu->per_cu, false);
+- if (attr_to_dynamic_prop (attr, die, cu, &prop, prop_type))
++ if (attr_to_dynamic_prop (attr, die, cu, &prop, prop_type, NULL, 0))
add_dyn_prop (DYN_PROP_ALLOCATED, prop, type);
}
else if (attr != NULL)
-@@ -25410,7 +25513,7 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
- attr = dwarf2_attr (die, DW_AT_associated, cu);
- if (attr_form_is_block (attr))
+@@ -25895,7 +26017,7 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
{
-- if (attr_to_dynamic_prop (attr, die, cu, &prop))
-+ if (attr_to_dynamic_prop (attr, die, cu, &prop, NULL, 0))
+ struct type *prop_type
+ = dwarf2_per_cu_addr_sized_int_type (cu->per_cu, false);
+- if (attr_to_dynamic_prop (attr, die, cu, &prop, prop_type))
++ if (attr_to_dynamic_prop (attr, die, cu, &prop, prop_type, NULL, 0))
add_dyn_prop (DYN_PROP_ASSOCIATED, prop, type);
}
else if (attr != NULL)
-@@ -25422,7 +25525,7 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
-
+@@ -25908,7 +26030,7 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
/* Read DW_AT_data_location and set in type. */
attr = dwarf2_attr (die, DW_AT_data_location, cu);
-- if (attr_to_dynamic_prop (attr, die, cu, &prop))
-+ if (attr_to_dynamic_prop (attr, die, cu, &prop, NULL, 0))
+ if (attr_to_dynamic_prop (attr, die, cu, &prop,
+- dwarf2_per_cu_addr_type (cu->per_cu)))
++ dwarf2_per_cu_addr_type (cu->per_cu), NULL, 0))
add_dyn_prop (DYN_PROP_DATA_LOCATION, prop, type);
if (dwarf2_per_objfile->die_type_hash == NULL)
diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c
--- a/gdb/f-typeprint.c
+++ b/gdb/f-typeprint.c
-@@ -37,7 +37,7 @@ static void f_type_print_args (struct type *, struct ui_file *);
- #endif
-
- static void f_type_print_varspec_suffix (struct type *, struct ui_file *, int,
-- int, int, int);
-+ int, int, int, int);
-
- void f_type_print_varspec_prefix (struct type *, struct ui_file *,
- int, int);
-@@ -53,18 +53,6 @@ f_print_type (struct type *type, const char *varstring, struct ui_file *stream,
- {
- enum type_code code;
-
-- if (type_not_associated (type))
-- {
-- val_print_not_associated (stream);
-- return;
-- }
--
-- if (type_not_allocated (type))
-- {
-- val_print_not_allocated (stream);
-- return;
-- }
--
- f_type_print_base (type, stream, show, level);
- code = TYPE_CODE (type);
- if ((varstring != NULL && *varstring != '\0')
-@@ -89,7 +77,7 @@ f_print_type (struct type *type, const char *varstring, struct ui_file *stream,
-
- demangled_args = (*varstring != '\0'
- && varstring[strlen (varstring) - 1] == ')');
-- f_type_print_varspec_suffix (type, stream, show, 0, demangled_args, 0);
-+ f_type_print_varspec_suffix (type, stream, show, 0, demangled_args, 0, 0);
- }
- }
-
-@@ -159,7 +147,7 @@ f_type_print_varspec_prefix (struct type *type, struct ui_file *stream,
- static void
- f_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
- int show, int passed_a_ptr, int demangled_args,
-- int arrayprint_recurse_level)
-+ int arrayprint_recurse_level, int print_rank_only)
- {
- int upper_bound, lower_bound;
-
-@@ -183,34 +171,50 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
- fprintf_filtered (stream, "(");
-
- if (type_not_associated (type))
-- val_print_not_associated (stream);
-+ print_rank_only = 1;
- else if (type_not_allocated (type))
-- val_print_not_allocated (stream);
-+ print_rank_only = 1;
-+ else if ((TYPE_ASSOCIATED_PROP (type)
-+ && PROP_CONST != TYPE_DYN_PROP_KIND (TYPE_ASSOCIATED_PROP (type)))
+@@ -197,15 +197,14 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
+ print_rank_only = true;
+ else if ((TYPE_ASSOCIATED_PROP (type)
+ && PROP_CONST != TYPE_DYN_PROP_KIND (TYPE_ASSOCIATED_PROP (type)))
+- || (TYPE_ALLOCATED_PROP (type)
+- && PROP_CONST != TYPE_DYN_PROP_KIND (TYPE_ALLOCATED_PROP (type)))
+- || (TYPE_DATA_LOCATION (type)
+- && PROP_CONST != TYPE_DYN_PROP_KIND (TYPE_DATA_LOCATION (type))))
+- {
+- /* This case exist when we ptype a typename which has the dynamic
+- properties but cannot be resolved as there is no object. */
+- print_rank_only = true;
+- }
+ || (TYPE_ALLOCATED_PROP (type)
+ && PROP_CONST != TYPE_DYN_PROP_KIND (TYPE_ALLOCATED_PROP (type)))
+ || (TYPE_DATA_LOCATION (type)
+ /* This case exist when we ptype a typename which has the
+ dynamic properties but cannot be resolved as there is
+ no object. */
-+ print_rank_only = 1;
-+
-+ if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_ARRAY)
-+ f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0,
-+ 0, 0, arrayprint_recurse_level,
-+ print_rank_only);
-+
-+ if (print_rank_only == 1)
-+ fprintf_filtered (stream, ":");
++ print_rank_only = true;
+
+ if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_ARRAY)
+ f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0,
+@@ -217,8 +216,9 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
else
-- {
-- if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_ARRAY)
-- f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0,
-- 0, 0, arrayprint_recurse_level);
--
-- lower_bound = f77_get_lowerbound (type);
-- if (lower_bound != 1) /* Not the default. */
-- fprintf_filtered (stream, "%d:", lower_bound);
--
-- /* Make sure that, if we have an assumed size array, we
-- print out a warning and print the upperbound as '*'. */
--
-- if (TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type))
-- fprintf_filtered (stream, "*");
-- else
-- {
-- upper_bound = f77_get_upperbound (type);
-- fprintf_filtered (stream, "%d", upper_bound);
-- }
--
-- if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_ARRAY)
-- f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0,
-- 0, 0, arrayprint_recurse_level);
-- }
-+ {
-+ lower_bound = f77_get_lowerbound (type);
-+ if (lower_bound != 1) /* Not the default. */
-+ fprintf_filtered (stream, "%d:", lower_bound);
-+
-+ /* Make sure that, if we have an assumed size array, we
-+ print out a warning and print the upperbound as '*'. */
-+
-+ if (TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type))
-+ fprintf_filtered (stream, "*");
-+ else
-+ {
-+ upper_bound = f77_get_upperbound (type);
-+ fprintf_filtered (stream, "%d", upper_bound);
-+ }
-+ }
-+
-+ if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_ARRAY)
-+ f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0,
-+ 0, 0, arrayprint_recurse_level,
-+ print_rank_only);
+ {
+ LONGEST lower_bound = f77_get_lowerbound (type);
+
- if (arrayprint_recurse_level == 1)
- fprintf_filtered (stream, ")");
- else
-@@ -221,13 +225,14 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
- case TYPE_CODE_PTR:
+ if (lower_bound != 1) /* Not the default. */
+- fprintf_filtered (stream, "%s:", plongest (lower_bound));
++ fprintf_filtered (stream, "%s:", plongest (lower_bound));
+
+ /* Make sure that, if we have an assumed size array, we
+ print out a warning and print the upperbound as '*'. */
+@@ -229,7 +229,7 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
+ {
+ LONGEST upper_bound = f77_get_upperbound (type);
+
+- fputs_filtered (plongest (upper_bound), stream);
++ fprintf_filtered (stream, "%s", plongest (upper_bound));
+ }
+ }
+
+@@ -249,7 +249,7 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
case TYPE_CODE_REF:
f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 1, 0,
-- arrayprint_recurse_level);
-+ arrayprint_recurse_level, 0);
- fprintf_filtered (stream, ")");
+ arrayprint_recurse_level, false);
+- fprintf_filtered (stream, " )");
++ fprintf_filtered (stream, ")");
break;
case TYPE_CODE_FUNC:
- f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0,
-- passed_a_ptr, 0, arrayprint_recurse_level);
-+ passed_a_ptr, 0, arrayprint_recurse_level,
-+ 0);
- if (passed_a_ptr)
- fprintf_filtered (stream, ")");
-
-@@ -388,7 +393,7 @@ f_type_print_base (struct type *type, struct ui_file *stream, int show,
- fputs_filtered (" :: ", stream);
- fputs_filtered (TYPE_FIELD_NAME (type, index), stream);
- f_type_print_varspec_suffix (TYPE_FIELD_TYPE (type, index),
-- stream, show - 1, 0, 0, 0);
-+ stream, show - 1, 0, 0, 0, 0);
- fputs_filtered ("\n", stream);
- }
- fprintfi_filtered (level, stream, "End Type ");
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
-@@ -1913,7 +1913,8 @@ is_dynamic_type_internal (struct type *type, int top_level)
+@@ -1939,7 +1939,8 @@ is_dynamic_type_internal (struct type *type, int top_level)
type = check_typedef (type);
/* We only want to recognize references at the outermost level. */
type = check_typedef (TYPE_TARGET_TYPE (type));
/* Types that have a dynamic TYPE_DATA_LOCATION are considered
-@@ -1947,6 +1948,7 @@ is_dynamic_type_internal (struct type *type, int top_level)
+@@ -1972,10 +1973,10 @@ is_dynamic_type_internal (struct type *type, int top_level)
+ || is_dynamic_type_internal (TYPE_TARGET_TYPE (type), 0));
}
+- case TYPE_CODE_STRING:
+ /* Strings are very much like an array of characters, and can be
+ treated as one here. */
case TYPE_CODE_ARRAY:
+ case TYPE_CODE_STRING:
{
gdb_assert (TYPE_NFIELDS (type) == 1);
-@@ -2065,7 +2067,8 @@ resolve_dynamic_array (struct type *type,
- struct dynamic_prop *prop;
- unsigned int bit_stride = 0;
-
-- gdb_assert (TYPE_CODE (type) == TYPE_CODE_ARRAY);
-+ gdb_assert (TYPE_CODE (type) == TYPE_CODE_ARRAY
-+ || TYPE_CODE (type) == TYPE_CODE_STRING);
-
- type = copy_type (type);
-
-@@ -2090,11 +2093,15 @@ resolve_dynamic_array (struct type *type,
+@@ -2139,11 +2140,15 @@ resolve_dynamic_array_or_string (struct type *type,
ary_dim = check_typedef (TYPE_TARGET_TYPE (elt_type));
- if (ary_dim != NULL && TYPE_CODE (ary_dim) == TYPE_CODE_ARRAY)
+ if (ary_dim != NULL && (TYPE_CODE (ary_dim) == TYPE_CODE_ARRAY
+ || TYPE_CODE (ary_dim) == TYPE_CODE_STRING))
- elt_type = resolve_dynamic_array (ary_dim, addr_stack);
+ elt_type = resolve_dynamic_array_or_string (ary_dim, addr_stack);
else
elt_type = TYPE_TARGET_TYPE (type);
prop = get_dyn_prop (DYN_PROP_BYTE_STRIDE, type);
if (prop != NULL)
{
-@@ -2249,6 +2256,28 @@ resolve_dynamic_struct (struct type *type,
+@@ -2295,6 +2300,28 @@ resolve_dynamic_struct (struct type *type,
return resolved_type;
}
/* Worker for resolved_dynamic_type. */
static struct type *
-@@ -2297,7 +2326,12 @@ resolve_dynamic_type_internal (struct type *type,
- break;
- }
-
+@@ -2349,6 +2376,9 @@ resolve_dynamic_type_internal (struct type *type,
+ case TYPE_CODE_ARRAY:
+ resolved_type = resolve_dynamic_array_or_string (type, addr_stack);
+ break;
+ case TYPE_CODE_PTR:
+ resolved_type = resolve_dynamic_pointer (type, addr_stack);
+ break;
-+
- case TYPE_CODE_ARRAY:
-+ case TYPE_CODE_STRING:
- resolved_type = resolve_dynamic_array (type, addr_stack);
- break;
+ case TYPE_CODE_RANGE:
+ resolved_type = resolve_dynamic_range (type, addr_stack);
diff --git a/gdb/testsuite/gdb.cp/vla-cxx.cc b/gdb/testsuite/gdb.cp/vla-cxx.cc
--- a/gdb/testsuite/gdb.cp/vla-cxx.cc
+++ b/gdb/testsuite/gdb.cp/vla-cxx.cc
+
+gdb_breakpoint [gdb_get_line_number "Before pointer assignment"]
+gdb_continue_to_breakpoint "Before pointer assignment"
-+gdb_test "print logp" "= \\(PTR TO -> \\( $logical \\)\\) 0x0" "print logp, not associated"
++gdb_test "print logp" "= \\(PTR TO -> \\( $logical\\)\\) 0x0" "print logp, not associated"
+gdb_test "print *logp" "Cannot access memory at address 0x0" "print *logp, not associated"
-+gdb_test "print comp" "= \\(PTR TO -> \\( $complex \\)\\) 0x0" "print comp, not associated"
++gdb_test "print comp" "= \\(PTR TO -> \\( $complex\\)\\) 0x0" "print comp, not associated"
+gdb_test "print *comp" "Cannot access memory at address 0x0" "print *comp, not associated"
-+gdb_test "print charp" "= \\(PTR TO -> \\( character\\*1 \\)\\) 0x0" "print charp, not associated"
++gdb_test "print charp" "= \\(PTR TO -> \\( character\\*1\\)\\) 0x0" "print charp, not associated"
+gdb_test "print *charp" "Cannot access memory at address 0x0" "print *charp, not associated"
-+gdb_test "print charap" "= \\(PTR TO -> \\( character\\*3 \\)\\) 0x0" "print charap, not associated"
++gdb_test "print charap" "= \\(PTR TO -> \\( character\\*3\\)\\) 0x0" "print charap, not associated"
+gdb_test "print *charap" "Cannot access memory at address 0x0" "print *charap, not associated"
-+gdb_test "print intp" "= \\(PTR TO -> \\( $int \\)\\) 0x0" "print intp, not associated"
++gdb_test "print intp" "= \\(PTR TO -> \\( $int\\)\\) 0x0" "print intp, not associated"
+gdb_test "print *intp" "Cannot access memory at address 0x0" "print *intp, not associated"
+set test "print intap, not associated"
+gdb_test_multiple "print intap" $test {
+ pass $test
+ }
+}
-+gdb_test "print realp" "= \\(PTR TO -> \\( $real \\)\\) 0x0" "print realp, not associated"
++gdb_test "print realp" "= \\(PTR TO -> \\( $real\\)\\) 0x0" "print realp, not associated"
+gdb_test "print *realp" "Cannot access memory at address 0x0" "print *realp, not associated"
-+gdb_test "print \$my_var = intp" "= \\(PTR TO -> \\( $int \\)\\) 0x0"
++gdb_test "print \$my_var = intp" "= \\(PTR TO -> \\( $int\\)\\) 0x0"
+set test "print cyclicp1, not associated"
+gdb_test_multiple "print cyclicp1" $test {
+ -re "= \\( i = -?\\d+, p = 0x0 \\)\r\n$gdb_prompt $" {
+}
+set test "print cyclicp1%p, not associated"
+gdb_test_multiple "print cyclicp1%p" $test {
-+ -re "= \\(PTR TO -> \\( Type typewithpointer \\)\\) 0x0\r\n$gdb_prompt $" {
++ -re "= \\(PTR TO -> \\( Type typewithpointer\\)\\) 0x0\r\n$gdb_prompt $" {
+ pass $test
+ }
-+ -re "= \\(PTR TO -> \\( Type typewithpointer \\)\\) <not associated>\r\n$gdb_prompt $" {
++ -re "= \\(PTR TO -> \\( Type typewithpointer\\)\\) <not associated>\r\n$gdb_prompt $" {
+ pass $test
+ }
+}
+
+gdb_breakpoint [gdb_get_line_number "After value assignment"]
+gdb_continue_to_breakpoint "After value assignment"
-+gdb_test "print logp" "= \\(PTR TO -> \\( $logical \\)\\) $hex\( <.*>\)?"
++gdb_test "print logp" "= \\(PTR TO -> \\( $logical\\)\\) $hex\( <.*>\)?"
+gdb_test "print *logp" "= \\.TRUE\\."
-+gdb_test "print comp" "= \\(PTR TO -> \\( $complex \\)\\) $hex\( <.*>\)?"
++gdb_test "print comp" "= \\(PTR TO -> \\( $complex\\)\\) $hex\( <.*>\)?"
+gdb_test "print *comp" "= \\(1,2\\)"
-+gdb_test "print charp" "= \\(PTR TO -> \\( character\\*1 \\)\\) $hex\( <.*>\)?"
++gdb_test "print charp" "= \\(PTR TO -> \\( character\\*1\\)\\) $hex\( <.*>\)?"
+gdb_test "print *charp" "= 'a'"
-+gdb_test "print charap" "= \\(PTR TO -> \\( character\\*3 \\)\\) $hex\( <.*>\)?"
++gdb_test "print charap" "= \\(PTR TO -> \\( character\\*3\\)\\) $hex\( <.*>\)?"
+gdb_test "print *charap" "= 'abc'"
-+gdb_test "print intp" "= \\(PTR TO -> \\( $int \\)\\) $hex\( <.*>\)?"
++gdb_test "print intp" "= \\(PTR TO -> \\( $int\\)\\) $hex\( <.*>\)?"
+gdb_test "print *intp" "= 10"
+set test_name "print intap, associated"
+gdb_test_multiple "print intap" $test_name {
+ pass $test_name
+ }
+}
-+gdb_test "print realp" "= \\(PTR TO -> \\( $real \\)\\) $hex\( <.*>\)?"
++gdb_test "print realp" "= \\(PTR TO -> \\( $real\\)\\) $hex\( <.*>\)?"
+gdb_test "print *realp" "= 3\\.14000\\d+"
-+gdb_test "print arrayOfPtr(2)%p" "= \\(PTR TO -> \\( Type two \\)\\) $hex\( <.*>\)?"
++gdb_test "print arrayOfPtr(2)%p" "= \\(PTR TO -> \\( Type two\\)\\) $hex\( <.*>\)?"
+gdb_test "print *(arrayOfPtr(2)%p)" "= \\( ivla1 = \\(11, 12, 13\\), ivla2 = \\(\\( 211, 221\\) \\( 212, 222\\) \\) \\)"
+set test_name "print arrayOfPtr(3)%p"
+gdb_test_multiple $test_name $test_name {
-+ -re "= \\(PTR TO -> \\( Type two \\)\\) <not associated>\r\n$gdb_prompt $" {
++ -re "= \\(PTR TO -> \\( Type two\\)\\) <not associated>\r\n$gdb_prompt $" {
+ pass $test_name
+ }
-+ -re "= \\(PTR TO -> \\( Type two \\)\\) 0x0\r\n$gdb_prompt $" {
++ -re "= \\(PTR TO -> \\( Type two\\)\\) 0x0\r\n$gdb_prompt $" {
+ pass $test_name
+ }
+}
+ }
+}
+gdb_test "print cyclicp1" "= \\( i = 1, p = $hex\( <.*>\)? \\)"
-+gdb_test "print cyclicp1%p" "= \\(PTR TO -> \\( Type typewithpointer \\)\\) $hex\( <.*>\)?"
++gdb_test "print cyclicp1%p" "= \\(PTR TO -> \\( Type typewithpointer\\)\\) $hex\( <.*>\)?"
+gdb_test "print *((integer*) &inta + 2)" "= 3" "print temporary pointer, array"
+gdb_test "print *((integer*) &intvla + 3)" "= 4" "print temporary pointer, allocated vla"
-+gdb_test "print \$pc" "= \\(PTR TO -> \\( void \\(\\)\\(\\)\\)\\) $hex <pointers\\+\\d+>" "Print program counter"
++gdb_test "print \$pc" "= \\(PTR TO -> \\( void \\(\\) \\(\\)\\)\\) $hex <pointers\\+\\d+>" "Print program counter"
diff --git a/gdb/testsuite/gdb.fortran/pointers.f90 b/gdb/testsuite/gdb.fortran/pointers.f90
-new file mode 100644
---- /dev/null
+--- a/gdb/testsuite/gdb.fortran/pointers.f90
+++ b/gdb/testsuite/gdb.fortran/pointers.f90
-@@ -0,0 +1,109 @@
-+! Copyright 2016 Free Software Foundation, Inc.
-+!
-+! This program is free software; you can redistribute it and/or modify
-+! it under the terms of the GNU General Public License as published by
-+! the Free Software Foundation; either version 3 of the License, or
-+! (at your option) any later version.
-+!
-+! This program is distributed in the hope that it will be useful,
-+! but WITHOUT ANY WARRANTY; without even the implied warranty of
-+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+! GNU General Public License for more details.
-+!
-+! You should have received a copy of the GNU General Public License
-+! along with this program. If not, see <http://www.gnu.org/licenses/>.
-+
-+program pointers
-+
-+ type :: two
-+ integer, allocatable :: ivla1 (:)
-+ integer, allocatable :: ivla2 (:, :)
-+ end type two
-+
+@@ -20,21 +20,34 @@ program pointers
+ integer, allocatable :: ivla2 (:, :)
+ end type two
+
+ type :: typeWithPointer
+ integer i
+ type(typeWithPointer), pointer:: p
+ type (two), pointer :: p
+ end type twoPtr
+
-+ logical, target :: logv
-+ complex, target :: comv
-+ character, target :: charv
-+ character (len=3), target :: chara
-+ integer, target :: intv
-+ integer, target, dimension (10,2) :: inta
+ logical, target :: logv
+ complex, target :: comv
+ character, target :: charv
+ character (len=3), target :: chara
+ integer, target :: intv
+ integer, target, dimension (10,2) :: inta
+- real, target :: realv
+- type(two), target :: twov
+ integer, target, allocatable, dimension (:) :: intvla
+ real, target :: realv
+ type(two), target :: twov
+ type(twoPtr) :: arrayOfPtr (3)
+ type(typeWithPointer), target:: cyclicp1,cyclicp2
-+
-+ logical, pointer :: logp
-+ complex, pointer :: comp
+
+ logical, pointer :: logp
+ complex, pointer :: comp
+- character, pointer :: charp
+- character (len=3), pointer :: charap
+ character, pointer:: charp
+ character (len=3), pointer:: charap
-+ integer, pointer :: intp
-+ integer, pointer, dimension (:,:) :: intap
+ integer, pointer :: intp
+ integer, pointer, dimension (:,:) :: intap
+ integer, pointer, dimension (:) :: intvlap
-+ real, pointer :: realp
-+ type(two), pointer :: twop
-+
-+ nullify (logp)
-+ nullify (comp)
-+ nullify (charp)
-+ nullify (charap)
-+ nullify (intp)
-+ nullify (intap)
+ real, pointer :: realp
+ type(two), pointer :: twop
+
+@@ -44,8 +57,14 @@ program pointers
+ nullify (charap)
+ nullify (intp)
+ nullify (intap)
+ nullify (intvlap)
-+ nullify (realp)
-+ nullify (twop)
+ nullify (realp)
+ nullify (twop)
+ nullify (arrayOfPtr(1)%p)
+ nullify (arrayOfPtr(2)%p)
+ nullify (arrayOfPtr(3)%p)
+ nullify (cyclicp1%p)
+ nullify (cyclicp2%p)
-+
-+ logp => logv ! Before pointer assignment
-+ comp => comv
-+ charp => charv
-+ charap => chara
-+ intp => intv
-+ intap => inta
+
+ logp => logv ! Before pointer assignment
+ comp => comv
+@@ -53,8 +72,14 @@ program pointers
+ charap => chara
+ intp => intv
+ intap => inta
+ intvlap => intvla
-+ realp => realv
-+ twop => twov
+ realp => realv
+ twop => twov
+ arrayOfPtr(2)%p => twov
+ cyclicp1%i = 1
+ cyclicp1%p => cyclicp2
+ cyclicp2%i = 2
+ cyclicp2%p => cyclicp1
-+
-+ logv = associated(logp) ! Before value assignment
-+ comv = cmplx(1,2)
-+ charv = "a"
-+ chara = "abc"
-+ intv = 10
-+ inta(:,:) = 1
-+ inta(3,1) = 3
+
+ logv = associated(logp) ! Before value assignment
+ comv = cmplx(1,2)
+@@ -63,6 +88,10 @@ program pointers
+ intv = 10
+ inta(:,:) = 1
+ inta(3,1) = 3
+ allocate (intvla(10))
+ intvla(:) = 2
+ intvla(4) = 4
+ intvlap => intvla
-+ realv = 3.14
-+
-+ allocate (twov%ivla1(3))
-+ allocate (twov%ivla2(2,2))
-+ twov%ivla1(1) = 11
-+ twov%ivla1(2) = 12
-+ twov%ivla1(3) = 13
-+ twov%ivla2(1,1) = 211
-+ twov%ivla2(2,1) = 221
-+ twov%ivla2(1,2) = 212
-+ twov%ivla2(2,2) = 222
-+
-+ intv = intv + 1 ! After value assignment
-+
-+end program pointers
+ realv = 3.14
+
+ allocate (twov%ivla1(3))
diff --git a/gdb/testsuite/gdb.fortran/print_type.exp b/gdb/testsuite/gdb.fortran/print_type.exp
-new file mode 100644
---- /dev/null
+--- a/gdb/testsuite/gdb.fortran/print_type.exp
+++ b/gdb/testsuite/gdb.fortran/print_type.exp
-@@ -0,0 +1,100 @@
-+# Copyright 2016 Free Software Foundation, Inc.
-+
-+# This program is free software; you can redistribute it and/or modify
-+# it under the terms of the GNU General Public License as published by
-+# the Free Software Foundation; either version 3 of the License, or
-+# (at your option) any later version.
-+#
-+# This program is distributed in the hope that it will be useful,
-+# but WITHOUT ANY WARRANTY; without even the implied warranty of
-+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+# GNU General Public License for more details.
-+#
-+# You should have received a copy of the GNU General Public License
-+# along with this program. If not, see <http://www.gnu.org/licenses/>.
-+
-+standard_testfile "pointers.f90"
-+load_lib fortran.exp
-+
-+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
-+ {debug f90 quiet}] } {
-+ return -1
-+}
-+
-+
-+if ![runto_main] {
-+ untested "could not run to main"
-+ return -1
-+}
-+
-+# Depending on the compiler being used, the type names can be printed differently.
-+set logical [fortran_logical4]
-+set real [fortran_real4]
-+set int [fortran_int4]
-+set complex [fortran_complex4]
-+
-+gdb_breakpoint [gdb_get_line_number "Before pointer assignment"]
-+gdb_continue_to_breakpoint "Before pointer assignment"
-+gdb_test "ptype logp" "type = PTR TO -> \\( $logical \\)" "ptype logp, not associated"
-+gdb_test "ptype comp" "type = PTR TO -> \\( $complex \\)" "ptype comp, not associated"
-+gdb_test "ptype charp" "type = PTR TO -> \\( character\\*1 \\)" "ptype charp, not associated"
-+gdb_test "ptype charap" "type = PTR TO -> \\( character\\*3 \\)" "ptype charap, not associated"
-+gdb_test "ptype intp" "type = PTR TO -> \\( $int \\)" "ptype intp, not associated"
-+set test "ptype intap, not associated"
-+gdb_test_multiple "ptype intap" $test {
-+ -re "type = PTR TO -> \\( $int \\(:,:\\)\\)\r\n$gdb_prompt $" {
-+ pass $test
-+ }
-+ -re "type = $int \\(:,:\\)\r\n$gdb_prompt $" {
-+ pass $test
-+ }
-+}
-+gdb_test "ptype realp" "type = PTR TO -> \\( $real \\)" "ptype realp, not associated"
-+gdb_test "ptype twop" \
-+ [multi_line "type = PTR TO -> \\( Type two" \
-+ " $int :: ivla1\\(:\\)" \
-+ " $int :: ivla2\\(:,:\\)" \
-+ "End Type two \\)"] \
-+ "ptype twop, not associated"
-+gdb_test "ptype two" \
-+ [multi_line "type = Type two" \
-+ " $int :: ivla1\\(:\\)" \
-+ " $int :: ivla2\\(:,:\\)" \
-+ "End Type two"]
-+
-+
-+gdb_breakpoint [gdb_get_line_number "Before value assignment"]
-+gdb_continue_to_breakpoint "Before value assignment"
-+gdb_test "ptype twop" \
-+ [multi_line "type = PTR TO -> \\( Type two" \
-+ " $int :: ivla1\\(:\\)" \
-+ " $int :: ivla2\\(:,:\\)" \
-+ "End Type two \\)"]
-+
-+
-+gdb_breakpoint [gdb_get_line_number "After value assignment"]
-+gdb_continue_to_breakpoint "After value assignment"
-+gdb_test "ptype logv" "type = $logical"
-+gdb_test "ptype comv" "type = $complex"
-+gdb_test "ptype charv" "type = character\\*1"
-+gdb_test "ptype chara" "type = character\\*3"
-+gdb_test "ptype intv" "type = $int"
-+gdb_test "ptype inta" "type = $int \\(10,2\\)"
-+gdb_test "ptype realv" "type = $real"
-+
-+
-+gdb_test "ptype logp" "type = PTR TO -> \\( $logical \\)"
-+gdb_test "ptype comp" "type = PTR TO -> \\( $complex \\)"
-+gdb_test "ptype charp" "type = PTR TO -> \\( character\\*1 \\)"
-+gdb_test "ptype charap" "type = PTR TO -> \\( character\\*3 \\)"
-+gdb_test "ptype intp" "type = PTR TO -> \\( $int \\)"
-+set test "ptype intap"
-+gdb_test_multiple $test $test {
-+ -re "type = $int \\(10,2\\)\r\n$gdb_prompt $" {
-+ pass $test
-+ }
-+ -re "type = PTR TO -> \\( $int \\(10,2\\)\\)\r\n$gdb_prompt $" {
-+ pass $test
-+ }
-+}
-+gdb_test "ptype realp" "type = PTR TO -> \\( $real \\)"
-diff --git a/gdb/testsuite/gdb.fortran/vla-ptype.exp b/gdb/testsuite/gdb.fortran/vla-ptype.exp
---- a/gdb/testsuite/gdb.fortran/vla-ptype.exp
-+++ b/gdb/testsuite/gdb.fortran/vla-ptype.exp
-@@ -32,9 +32,9 @@ set real [fortran_real4]
- # Check the ptype of various VLA states and pointer to VLA's.
- gdb_breakpoint [gdb_get_line_number "vla1-init"]
- gdb_continue_to_breakpoint "vla1-init"
--gdb_test "ptype vla1" "type = <not allocated>" "ptype vla1 not initialized"
--gdb_test "ptype vla2" "type = <not allocated>" "ptype vla2 not initialized"
--gdb_test "ptype pvla" "type = <not associated>" "ptype pvla not initialized"
-+gdb_test "ptype vla1" "type = $real \\(:,:,:\\)" "ptype vla1 not initialized"
-+gdb_test "ptype vla2" "type = $real \\(:,:,:\\)" "ptype vla2 not initialized"
-+gdb_test "ptype pvla" "type = $real \\(:,:,:\\)" "ptype pvla not initialized"
- gdb_test "ptype vla1(3, 6, 9)" "no such vector element \\\(vector not allocated\\\)" \
- "ptype vla1(3, 6, 9) not initialized"
- gdb_test "ptype vla2(5, 45, 20)" \
-@@ -81,20 +81,20 @@ gdb_test "ptype vla2(5, 45, 20)" "type = $real" \
+@@ -1,5 +1,6 @@
+ # Copyright 2019-2020 Free Software Foundation, Inc.
+ #
++
+ # This program is free software; you can redistribute it and/or modify
+ # it under the terms of the GNU General Public License as published by
+ # the Free Software Foundation; either version 3 of the License, or
+@@ -40,7 +41,7 @@ set complex [fortran_complex4]
+ # matches the string TYPE.
+ proc check_pointer_type { var_name type } {
+ gdb_test "ptype ${var_name}" \
+- "type = PTR TO -> \\( ${type} \\)"
++ "type = PTR TO -> \\( ${type}\\)"
+ }
- gdb_breakpoint [gdb_get_line_number "pvla-deassociated"]
- gdb_continue_to_breakpoint "pvla-deassociated"
--gdb_test "ptype pvla" "type = <not associated>" "ptype pvla deassociated"
-+gdb_test "ptype pvla" "type = $real \\(:,:,:\\)" "ptype pvla deassociated"
- gdb_test "ptype pvla(5, 45, 20)" \
- "no such vector element \\\(vector not associated\\\)" \
- "ptype pvla(5, 45, 20) not associated"
+ gdb_breakpoint [gdb_get_line_number "Before pointer assignment"]
+@@ -85,7 +86,8 @@ gdb_test "ptype twop" \
+ [multi_line "type = PTR TO -> \\( Type two" \
+ " $int, allocatable :: ivla1\\(:\\)" \
+ " $int, allocatable :: ivla2\\(:,:\\)" \
+- "End Type two \\)"]
++ "End Type two\\)"]
++
- gdb_breakpoint [gdb_get_line_number "vla1-deallocated"]
- gdb_continue_to_breakpoint "vla1-deallocated"
--gdb_test "ptype vla1" "type = <not allocated>" "ptype vla1 not allocated"
-+gdb_test "ptype vla1" "type = $real \\(:,:,:\\)" "ptype vla1 not allocated"
- gdb_test "ptype vla1(3, 6, 9)" "no such vector element \\\(vector not allocated\\\)" \
- "ptype vla1(3, 6, 9) not allocated"
+ gdb_breakpoint [gdb_get_line_number "After value assignment"]
+ gdb_continue_to_breakpoint "After value assignment"
+@@ -97,11 +99,11 @@ gdb_test "ptype intv" "type = $int"
+ gdb_test "ptype inta" "type = $int \\(10,2\\)"
+ gdb_test "ptype realv" "type = $real"
- gdb_breakpoint [gdb_get_line_number "vla2-deallocated"]
- gdb_continue_to_breakpoint "vla2-deallocated"
--gdb_test "ptype vla2" "type = <not allocated>" "ptype vla2 not allocated"
-+gdb_test "ptype vla2" "type = $real \\(:,:,:\\)" "ptype vla2 not allocated"
- gdb_test "ptype vla2(5, 45, 20)" \
- "no such vector element \\\(vector not allocated\\\)" \
- "ptype vla2(5, 45, 20) not allocated"
+-gdb_test "ptype logp" "type = PTR TO -> \\( $logical \\)"
+-gdb_test "ptype comp" "type = PTR TO -> \\( $complex \\)"
+-gdb_test "ptype charp" "type = PTR TO -> \\( character\\*1 \\)"
+-gdb_test "ptype charap" "type = PTR TO -> \\( character\\*3 \\)"
+-gdb_test "ptype intp" "type = PTR TO -> \\( $int \\)"
++gdb_test "ptype logp" "type = PTR TO -> \\( $logical\\)"
++gdb_test "ptype comp" "type = PTR TO -> \\( $complex\\)"
++gdb_test "ptype charp" "type = PTR TO -> \\( character\\*1\\)"
++gdb_test "ptype charap" "type = PTR TO -> \\( character\\*3\\)"
++gdb_test "ptype intp" "type = PTR TO -> \\( $int\\)"
+ set test "ptype intap"
+ gdb_test_multiple $test $test {
+ -re "type = $int \\(10,2\\)\r\n$gdb_prompt $" {
+@@ -111,4 +113,4 @@ gdb_test_multiple $test $test {
+ pass $test
+ }
+ }
+-gdb_test "ptype realp" "type = PTR TO -> \\( $real \\)"
++gdb_test "ptype realp" "type = PTR TO -> \\( $real\\)"
diff --git a/gdb/testsuite/gdb.fortran/vla-strings.exp b/gdb/testsuite/gdb.fortran/vla-strings.exp
new file mode 100644
--- /dev/null
+gdb_continue_to_breakpoint "var_char-allocated-1"
+set test "whatis var_char first time"
+gdb_test_multiple "whatis var_char" $test {
-+ -re "type = PTR TO -> \\( character\\*10 \\)\r\n$gdb_prompt $" {
++ -re "type = PTR TO -> \\( character\\*10\\)\r\n$gdb_prompt $" {
+ pass $test
+ }
+ -re "type = character\\*10\r\n$gdb_prompt $" {
+}
+set test "ptype var_char first time"
+gdb_test_multiple "ptype var_char" $test {
-+ -re "type = PTR TO -> \\( character\\*10 \\)\r\n$gdb_prompt $" {
++ -re "type = PTR TO -> \\( character\\*10\\)\r\n$gdb_prompt $" {
+ pass $test
+ }
+ -re "type = character\\*10\r\n$gdb_prompt $" {
+gdb_continue_to_breakpoint "var_char-filled-1"
+set test "print var_char, var_char-filled-1"
+gdb_test_multiple "print var_char" $test {
-+ -re "= \\(PTR TO -> \\( character\\*3 \\)\\) $hex\r\n$gdb_prompt $" {
++ -re "= \\(PTR TO -> \\( character\\*3\\)\\) $hex\r\n$gdb_prompt $" {
+ gdb_test "print *var_char" "= 'foo'" "print *var_char, var_char-filled-1"
+ pass $test
+ }
+}
+set test "ptype var_char, var_char-filled-1"
+gdb_test_multiple "ptype var_char" $test {
-+ -re "type = PTR TO -> \\( character\\*3 \\)\r\n$gdb_prompt $" {
++ -re "type = PTR TO -> \\( character\\*3\\)\r\n$gdb_prompt $" {
+ pass $test
+ }
+ -re "type = character\\*3\r\n$gdb_prompt $" {
+gdb_continue_to_breakpoint "var_char-filled-2"
+set test "print var_char, var_char-filled-2"
+gdb_test_multiple "print var_char" $test {
-+ -re "= \\(PTR TO -> \\( character\\*6 \\)\\) $hex\r\n$gdb_prompt $" {
++ -re "= \\(PTR TO -> \\( character\\*6\\)\\) $hex\r\n$gdb_prompt $" {
+ gdb_test "print *var_char" "= 'foobar'" "print *var_char, var_char-filled-2"
+ pass $test
+ }
+}
+set test "ptype var_char, var_char-filled-2"
+gdb_test_multiple "ptype var_char" $test {
-+ -re "type = PTR TO -> \\( character\\*6 \\)\r\n$gdb_prompt $" {
++ -re "type = PTR TO -> \\( character\\*6\\)\r\n$gdb_prompt $" {
+ pass $test
+ }
+ -re "type = character\\*6\r\n$gdb_prompt $" {
+ var_char_p => null()
+ l = associated(var_char_p) ! var_char_p-not-associated
+end program vla_strings
-diff --git a/gdb/testsuite/gdb.fortran/vla-type.exp b/gdb/testsuite/gdb.fortran/vla-type.exp
---- a/gdb/testsuite/gdb.fortran/vla-type.exp
-+++ b/gdb/testsuite/gdb.fortran/vla-type.exp
-@@ -132,7 +132,10 @@ gdb_test "ptype fivearr(2)%tone" \
- "End Type one" ]
-
- # Check allocation status of dynamic array and it's dynamic members
--gdb_test "ptype fivedynarr" "type = <not allocated>"
-+gdb_test "ptype fivedynarr" \
-+ [multi_line "type = Type five" \
-+ " Type one :: tone" \
-+ "End Type five \\(:\\)" ]
- gdb_test "next" ""
- gdb_test "ptype fivedynarr(2)" \
- [multi_line "type = Type five" \
-@@ -141,7 +144,7 @@ gdb_test "ptype fivedynarr(2)" \
- "ptype fivedynarr(2), tone is not allocated"
- gdb_test "ptype fivedynarr(2)%tone" \
- [multi_line "type = Type one" \
-- " $int :: ivla\\(<not allocated>\\)" \
-+ " $int :: ivla\\(:,:,:\\)" \
- "End Type one" ] \
- "ptype fivedynarr(2)%tone, not allocated"
-
diff --git a/gdb/testsuite/gdb.fortran/vla-value.exp b/gdb/testsuite/gdb.fortran/vla-value.exp
--- a/gdb/testsuite/gdb.fortran/vla-value.exp
+++ b/gdb/testsuite/gdb.fortran/vla-value.exp
gdb_continue_to_breakpoint "vla1-init"
gdb_test "print vla1" " = <not allocated>" "print non-allocated vla1"
gdb_test "print &vla1" \
-- " = \\\(PTR TO -> \\\( $real \\\(<not allocated>\\\)\\\)\\\) $hex" \
-+ " = \\\(PTR TO -> \\\( $real \\\(:,:,:\\\)\\\)\\\) $hex" \
+- " = \\\(PTR TO -> \\\( $real, allocatable \\\(:,:,:\\\) \\\)\\\) $hex" \
++ " = \\\(PTR TO -> \\\( $real, allocatable \\\(:,:,:\\\)\\\)\\\) $hex" \
"print non-allocated &vla1"
gdb_test "print vla1(1,1,1)" "no such vector element \\\(vector not allocated\\\)" \
"print member in non-allocated vla1 (1)"
+@@ -56,7 +56,7 @@ with_timeout_factor 15 {
+ "step over value assignment of vla1"
+ }
+ gdb_test "print &vla1" \
+- " = \\\(PTR TO -> \\\( $real, allocatable \\\(10,10,10\\\) \\\)\\\) $hex" \
++ " = \\\(PTR TO -> \\\( $real, allocatable \\\(10,10,10\\\)\\\)\\\) $hex" \
+ "print allocated &vla1"
+ gdb_test "print vla1(3, 6, 9)" " = 1311" "print allocated vla1(3,6,9)"
+ gdb_test "print vla1(1, 3, 8)" " = 1311" "print allocated vla1(1,3,8)"
@@ -76,7 +76,7 @@ gdb_test "print vla1(9, 9, 9)" " = 999" \
# Try to access values in undefined pointer to VLA (dangling)
gdb_test "print pvla" " = <not associated>" "print undefined pvla"
gdb_test "print &pvla" \
-- " = \\\(PTR TO -> \\\( $real \\\(<not associated>\\\)\\\)\\\) $hex" \
+- " = \\\(PTR TO -> \\\( $real \\\(:,:,:\\\) \\\)\\\) $hex" \
+ " = \\\(PTR TO -> \\\( $real \\\(:,:,:\\\)\\\)\\\) $hex" \
"print non-associated &pvla"
gdb_test "print pvla(1, 3, 8)" "no such vector element \\\(vector not associated\\\)" \
"print undefined pvla(1,3,8)"
-diff --git a/gdb/testsuite/gdb.mi/mi-vla-fortran.exp b/gdb/testsuite/gdb.mi/mi-vla-fortran.exp
---- a/gdb/testsuite/gdb.mi/mi-vla-fortran.exp
-+++ b/gdb/testsuite/gdb.mi/mi-vla-fortran.exp
-@@ -51,10 +51,10 @@ mi_expect_stop "breakpoint-hit" "vla" "" ".*vla.f90" "$bp_lineno" \
- mi_gdb_test "500-data-evaluate-expression vla1" \
- "500\\^done,value=\"<not allocated>\"" "evaluate not allocated vla, before allocation"
-
--mi_create_varobj_checked vla1_not_allocated vla1 "<not allocated>" \
-+mi_create_varobj_checked vla1_not_allocated vla1 "$real \\(:\\)" \
- "create local variable vla1_not_allocated"
- mi_gdb_test "501-var-info-type vla1_not_allocated" \
-- "501\\^done,type=\"<not allocated>\"" \
-+ "501\\^done,type=\"$real \\(:\\)\"" \
- "info type variable vla1_not_allocated"
- mi_gdb_test "502-var-show-format vla1_not_allocated" \
- "502\\^done,format=\"natural\"" \
-@@ -146,10 +146,10 @@ gdb_expect {
- -re "580\\^done,value=\"<not associated>\".*${mi_gdb_prompt}$" {
- pass $test
-
-- mi_create_varobj_checked pvla2_not_associated pvla2 "<not associated>" \
-+ mi_create_varobj_checked pvla2_not_associated pvla2 "$real \\(:,:\\)" \
- "create local variable pvla2_not_associated"
- mi_gdb_test "581-var-info-type pvla2_not_associated" \
-- "581\\^done,type=\"<not associated>\"" \
-+ "581\\^done,type=\"$real \\(:,:\\)\"" \
- "info type variable pvla2_not_associated"
- mi_gdb_test "582-var-show-format pvla2_not_associated" \
- "582\\^done,format=\"natural\"" \
+@@ -85,7 +85,7 @@ gdb_test "print pvla(1, 3, 8)" "no such vector element \\\(vector not associated
+ gdb_breakpoint [gdb_get_line_number "pvla-associated"]
+ gdb_continue_to_breakpoint "pvla-associated"
+ gdb_test "print &pvla" \
+- " = \\\(PTR TO -> \\\( $real \\\(10,10,10\\\) \\\)\\\) $hex" \
++ " = \\\(PTR TO -> \\\( $real \\\(10,10,10\\\)\\\)\\\) $hex" \
+ "print associated &pvla"
+ gdb_test "print pvla(3, 6, 9)" " = 42" "print associated pvla(3,6,9)"
+ gdb_test "print pvla(1, 3, 8)" " = 1001" "print associated pvla(1,3,8)"
diff --git a/gdb/typeprint.c b/gdb/typeprint.c
--- a/gdb/typeprint.c
+++ b/gdb/typeprint.c
-@@ -589,6 +589,25 @@ whatis_exp (const char *exp, int show)
+@@ -574,6 +574,25 @@ whatis_exp (const char *exp, int show)
printf_filtered (" */\n");
}
diff --git a/gdb/valprint.c b/gdb/valprint.c
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
-@@ -1108,12 +1108,6 @@ value_check_printable (struct value *val, struct ui_file *stream,
+@@ -1149,12 +1149,6 @@ value_check_printable (struct value *val, struct ui_file *stream,
return 0;
}