diff --git a/gdb/ChangeLog b/gdb/ChangeLog index d0bf6c86c55..b17249e95d6 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2014-04-11 Sanimir Agovic + + * c-typeprint.c (c_type_print_varspec_suffix): Added + check for not yet resolved high bound. If unresolved, print + "variable length" string to the console instead of random + length. + 2014-04-11 Sanimir Agovic * ada-lang.c (ada_value_primitive_packed_val): Re-fetch type from value. diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c index 4edc9ec3587..d91005850c5 100644 --- a/gdb/c-typeprint.c +++ b/gdb/c-typeprint.c @@ -689,7 +689,11 @@ c_type_print_varspec_suffix (struct type *type, fprintf_filtered (stream, (is_vector ? " __attribute__ ((vector_size(" : "[")); - if (get_array_bounds (type, &low_bound, &high_bound)) + /* Bounds are not yet resolved, print a bounds placeholder instead. */ + if (TYPE_HIGH_BOUND_KIND (TYPE_INDEX_TYPE (type)) == PROP_LOCEXPR + || TYPE_HIGH_BOUND_KIND (TYPE_INDEX_TYPE (type)) == PROP_LOCLIST) + fprintf_filtered (stream, "variable length"); + else if (get_array_bounds (type, &low_bound, &high_bound)) fprintf_filtered (stream, "%s", plongest (high_bound - low_bound + 1)); fprintf_filtered (stream, (is_vector ? ")))" : "]"));