public inbox for archer@sourceware.org
 help / color / mirror / Atom feed
* [vla] [commit] Print Fortran unbound arrays as empty
@ 2009-01-18 22:02 Jan Kratochvil
  0 siblings, 0 replies; only message in thread
From: Jan Kratochvil @ 2009-01-18 22:02 UTC (permalink / raw)
  To: archer

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-01-18 22:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-18 22:02 [vla] [commit] Print Fortran unbound arrays as empty Jan Kratochvil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).