[11/11] fortran: Testsuite, add sizeof tests to indexed and sliced arrays.

Message ID 20181127183139.71170-12-sbasierski@pl.sii.eu
State New
Headers show
Series
  • Adds functionality and fixes some code
Related show

Commit Message

Sebastian Basierski Nov. 27, 2018, 6:31 p.m.
From: Bernhard Heckel <bernhard.heckel@intel.com>


gdb/testsuite/Changelog:

	* gdb fortran/vla-sizeof.exp: Add tests of sizeof applied
to indexed and sliced arrays.
---
 gdb/testsuite/gdb.fortran/vla-sizeof.exp | 12 ++++++++++++
 1 file changed, 12 insertions(+)

-- 
2.17.1

Patch

diff --git a/gdb/testsuite/gdb.fortran/vla-sizeof.exp b/gdb/testsuite/gdb.fortran/vla-sizeof.exp
index 83bc849619..fca355f939 100644
--- a/gdb/testsuite/gdb.fortran/vla-sizeof.exp
+++ b/gdb/testsuite/gdb.fortran/vla-sizeof.exp
@@ -29,21 +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_test "print sizeof(vla1)" " = 4000" "print sizeof allocated vla1"
+gdb_test "print sizeof(vla1(3,2,1))" "4" "print sizeof non-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 non-associated pvla"
+gdb_test "print sizeof(pvla(3:4,2,1))" "800" "print sizeof sliced pvla"
 
 gdb_breakpoint [gdb_get_line_number "vla1-neg-bounds"]
 gdb_continue_to_breakpoint "vla1-neg-bounds"