public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] gdb/fortran: Add sizeof tests for indexed and sliced arrays
@ 2019-05-15 21:28 Andrew Burgess
  0 siblings, 0 replies; only message in thread
From: Andrew Burgess @ 2019-05-15 21:28 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=14237686d71b6ef1e6a85f2791cb54d1ec019cb1

commit 14237686d71b6ef1e6a85f2791cb54d1ec019cb1
Author: Andrew Burgess <andrew.burgess@embecosm.com>
Date:   Fri Mar 1 11:19:22 2019 +0000

    gdb/fortran: Add sizeof tests for indexed and sliced arrays
    
    Add tests for calling sizeof on indexed and sliced arrays, and on
    pointers to arrays.  These are all things that currently work, but
    were previously untested.
    
    gdb/testsuite/ChangeLog:
    
    	* gdb.fortran/vla-sizeof.exp: Add tests of sizeof applied to
    	indexed and sliced arrays, and pointers to arrays.

Diff:
---
 gdb/testsuite/ChangeLog                  |  5 +++++
 gdb/testsuite/gdb.fortran/vla-sizeof.exp | 23 +++++++++++++++++++----
 2 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 071c638..78289d6 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2019-05-15  Bernhard Heckel  <bernhard.heckel@intel.com>
+
+	* gdb.fortran/vla-sizeof.exp: Add tests of sizeof applied to
+	indexed and sliced arrays, and pointers to arrays.
+
 2019-05-14  Tom Tromey  <tromey@adacore.com>
 
 	* gdb.base/info-shared.exp (check_info_shared): Add "info shared"
diff --git a/gdb/testsuite/gdb.fortran/vla-sizeof.exp b/gdb/testsuite/gdb.fortran/vla-sizeof.exp
index 7f74a69..b6fdaeb 100644
--- a/gdb/testsuite/gdb.fortran/vla-sizeof.exp
+++ b/gdb/testsuite/gdb.fortran/vla-sizeof.exp
@@ -29,18 +29,33 @@ if ![runto_main] {
 gdb_breakpoint [gdb_get_line_number "vla1-init"]
 gdb_continue_to_breakpoint "vla1-init"
 gdb_test "print sizeof(vla1)" " = 0" "print sizeof non-allocated vla1"
+gdb_test "print sizeof(vla1(3,2,1))" \
+    "no such vector element \\(vector not allocated\\)" \
+    "print sizeof non-allocated indexed vla1"
+gdb_test "print sizeof(vla1(3:4,2,1))" "slice out of range" \
+    "print sizeof non-allocated sliced vla1"
 
 # Try to access value in allocated VLA
-gdb_breakpoint [gdb_get_line_number "vla2-allocated"]
-gdb_continue_to_breakpoint "vla2-allocated"
+gdb_breakpoint [gdb_get_line_number "vla1-allocated"]
+gdb_continue_to_breakpoint "vla1-allocated"
 gdb_test "print sizeof(vla1)" " = 4000" "print sizeof allocated vla1"
+gdb_test "print sizeof(vla1(3,2,1))" "4" \
+    "print sizeof element from allocated vla1"
+gdb_test "print sizeof(vla1(3:4,2,1))" "800" \
+    "print sizeof sliced vla1"
 
 # Try to access values in undefined pointer to VLA (dangling)
-gdb_breakpoint [gdb_get_line_number "vla1-filled"]
-gdb_continue_to_breakpoint "vla1-filled"
 gdb_test "print sizeof(pvla)" " = 0" "print sizeof non-associated pvla"
+gdb_test "print sizeof(pvla(3,2,1))" \
+    "no such vector element \\(vector not associated\\)" \
+    "print sizeof non-associated indexed pvla"
+gdb_test "print sizeof(pvla(3:4,2,1))" "slice out of range" \
+    "print sizeof non-associated sliced pvla"
 
 # Try to access values in pointer to VLA and compare them
 gdb_breakpoint [gdb_get_line_number "pvla-associated"]
 gdb_continue_to_breakpoint "pvla-associated"
 gdb_test "print sizeof(pvla)" " = 4000" "print sizeof associated pvla"
+gdb_test "print sizeof(pvla(3,2,1))" "4" \
+    "print sizeof element from associated pvla"
+gdb_test "print sizeof(pvla(3:4,2,1))" "800" "print sizeof sliced pvla"


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

only message in thread, other threads:[~2019-05-15 21:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-15 21:28 [binutils-gdb] gdb/fortran: Add sizeof tests for indexed and sliced arrays Andrew Burgess

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).