This is the mail archive of the
archer@sourceware.org
mailing list for the Archer project.
[vla] [commit] Print Fortran unbound arrays as empty
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: archer at sourceware dot org
- Date: Sun, 18 Jan 2009 23:01:57 +0100
- Subject: [vla] [commit] Print Fortran unbound arrays as empty
Print Fortran unbound arrays as empty instead of as a garbaged single element.
New testcase.
---
gdb/f-valprint.c | 11 ++++++-----
gdb/testsuite/gdb.fortran/dynamic.exp | 2 ++
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c
index 8e81b2e..a4d69fb 100644
--- a/gdb/f-valprint.c
+++ b/gdb/f-valprint.c
@@ -78,12 +78,13 @@ f77_get_upperbound (struct type *type)
if (TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type))
{
- /* We have an assumed size array on our hands. Assume that
- upper_bound == lower_bound so that we show at least 1 element.
- If the user wants to see more elements, let him manually ask for 'em
- and we'll subscript the array and show him. */
+ /* We have an assumed size array on our hands. As type_length_get
+ already assumes a length zero of arrays with underfined bounds VALADDR
+ passed to the Fortran functions does not contained the real inferior
+ memory content. User should request printing of specific array
+ elements instead. */
- return f77_get_lowerbound (type);
+ return f77_get_lowerbound (type) - 1;
}
return TYPE_ARRAY_UPPER_BOUND_VALUE (type);
diff --git a/gdb/testsuite/gdb.fortran/dynamic.exp b/gdb/testsuite/gdb.fortran/dynamic.exp
index 673b686..77a1203 100644
--- a/gdb/testsuite/gdb.fortran/dynamic.exp
+++ b/gdb/testsuite/gdb.fortran/dynamic.exp
@@ -132,6 +132,8 @@ gdb_test "ptype varz" "type = (PTR TO -> \\( )?real(\\(kind=4\\)|\\*4) \\(\\*\\)
# Intel Fortran Compiler 10.1.008 has a bug here - (2:11,7:7)
# as it produces DW_AT_lower_bound == DW_AT_upper_bound == 7.
gdb_test "ptype vart" "type = (PTR TO -> \\( )?real(\\(kind=4\\)|\\*4) \\(2:11,7:\\*\\)\\)?"
+gdb_test "p varz" "\\$\[0-9\]* = \\(\\)"
+gdb_test "p vart" "\\$\[0-9\]* = \\(\\)"
gdb_test "p varz(3)" "\\$\[0-9\]* = 4"
# maps to foo::vary(1,1)
gdb_test "p vart(2,7)" "\\$\[0-9\]* = 8"
--
1.6.0.6