vla: print "variable length" for unresolved dynamic bounds
authorSanimir Agovic <sanimir.agovic@intel.com>
Thu, 14 Nov 2013 09:55:52 +0000 (09:55 +0000)
committerJoel Brobecker <brobecker@adacore.com>
Mon, 14 Apr 2014 16:16:30 +0000 (09:16 -0700)
commit1d42e4c4d85cb12ce07a5349b1b2e11dce2d077d
tree17e22305c49e8b67135d385d67fc079469536540
parent9f1f738adae6b28c4f7db7e3607b4c224f1f7612
vla: print "variable length" for unresolved dynamic bounds

1| void foo (size_t n) {
2|   int vla[n];
3| }

Given the following expression

  (gdb) ptype &vla

Gdb evaluates the expression with EVAL_AVOID_SIDE_EFFECTS and thus
does not resolve the bounds information and misinterprets the high
bound as a constant. The current output is:

  type = int (*)[1289346]

this patch deals with this case and prints:

  type = int (*)[variable length]

instead.

gdb/ChangeLog:

* 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.
gdb/ChangeLog
gdb/c-typeprint.c