fdbd5e3
http://sourceware.org/ml/gdb-patches/2016-02/msg00847.html
fdbd5e3
Subject: [PATCH v2 6/6] fortran: test cases for subarray strides and slices
fdbd5e3
046f33b
From: Christoph Weinmann <christoph.t.weinmann@intel.com>
046f33b
046f33b
Add test cases for subarray creation with range, literal and
046f33b
stride value permutations for one, two, and three dimensional
046f33b
arrays.
046f33b
046f33b
2013-12-04  Christoph Weinmann  <christoph.t.weinmann@intel.com>
046f33b
046f33b
testsuite/gdb.fortran/
046f33b
	* static-arrays.exp: New test.
046f33b
	* static-arrays.f90: New file.
046f33b
046f33b
046f33b
Signed-off-by: Christoph Weinmann <christoph.t.weinmann@intel.com>
046f33b
---
fdbd5e3
 gdb/testsuite/gdb.fortran/static-arrays.exp | 421 ++++++++++++++++++++++++++++
fdbd5e3
 gdb/testsuite/gdb.fortran/static-arrays.f90 |  55 ++++
fdbd5e3
 2 files changed, 476 insertions(+)
046f33b
 create mode 100644 gdb/testsuite/gdb.fortran/static-arrays.exp
046f33b
 create mode 100644 gdb/testsuite/gdb.fortran/static-arrays.f90
046f33b
046f33b
diff --git a/gdb/testsuite/gdb.fortran/static-arrays.exp b/gdb/testsuite/gdb.fortran/static-arrays.exp
046f33b
new file mode 100644
fdbd5e3
index 0000000..cc9ecc0
046f33b
--- /dev/null
046f33b
+++ b/gdb/testsuite/gdb.fortran/static-arrays.exp
fdbd5e3
@@ -0,0 +1,421 @@
046f33b
+# Copyright 2015 Free Software Foundation, Inc.
046f33b
+#
046f33b
+# Contributed by Intel Corp. <christoph.t.weinmann@intel.com>
046f33b
+#
046f33b
+# This program is free software; you can redistribute it and/or modify
046f33b
+# it under the terms of the GNU General Public License as published by
046f33b
+# the Free Software Foundation; either version 3 of the License, or
046f33b
+# (at your option) any later version.
046f33b
+#
046f33b
+# This program is distributed in the hope that it will be useful,
046f33b
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
046f33b
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
046f33b
+# GNU General Public License for more details.
046f33b
+#
046f33b
+# You should have received a copy of the GNU General Public License
046f33b
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
046f33b
+
046f33b
+standard_testfile static-arrays.f90
046f33b
+
046f33b
+if { [prepare_for_testing $testfile.exp $testfile $srcfile {debug f90}] } {
046f33b
+    return -1
046f33b
+}
046f33b
+
046f33b
+if ![runto MAIN__] then {
046f33b
+    perror "couldn't run to breakpoint MAIN__"
046f33b
+    continue
046f33b
+}
046f33b
+
046f33b
+gdb_breakpoint [gdb_get_line_number "BP1"]
046f33b
+gdb_continue_to_breakpoint "BP1" ".*BP1.*"
046f33b
+
046f33b
+# Tests subarrays of one dimensional arrays with subrange variations
046f33b
+gdb_test "print ar1" "\\$\[0-9\]+ = \\(1, 2, 3, 4, 5, 6, 7, 8, 9\\)" \
046f33b
+		"print ar1."
046f33b
+gdb_test "print ar1\(4:7\)" "\\$\[0-9\]+ = \\(4, 5, 6, 7\\)" \
046f33b
+		"print ar1\(4:7\)"
046f33b
+gdb_test "print ar1\(8:\)" "\\$\[0-9\]+ = \\(8, 9\\).*" \
046f33b
+		"print ar1\(8:\)"
046f33b
+gdb_test "print ar1\(:3\)" "\\$\[0-9\]+ = \\(1, 2, 3\\).*" \
046f33b
+		"print ar1\(:3\)"
046f33b
+gdb_test "print ar1\(:\)" "\\$\[0-9\]+ = \\(1, 2, 3, 4, 5, 6, 7, 8, 9\\)" \
046f33b
+		"print ar1\(:\)"
046f33b
+
046f33b
+# Check assignment
046f33b
+gdb_test_no_output "set \$my_ary = ar1\(3:8\)"
046f33b
+gdb_test "print \$my_ary" \
046f33b
+		"\\$\[0-9\]+ = \\(3, 4, 5, 6, 7, 8\\)" \
046f33b
+		"Assignment of subarray to variable"
046f33b
+gdb_test_no_output "set ar1\(5\) = 42"
046f33b
+		gdb_test "print ar1\(3:8\)" \
046f33b
+		"\\$\[0-9\]+ = \\(3, 4, 42, 6, 7, 8\\)" \
046f33b
+		"print ar1\(3:8\) after assignment"
046f33b
+gdb_test "print \$my_ary" \
046f33b
+		"\\$\[0-9\]+ = \\(3, 4, 5, 6, 7, 8\\)" \
046f33b
+		"Assignment of subarray to variable after original array changed"
046f33b
+
046f33b
+# Test for subarrays of one dimensional arrays with literals
046f33b
+		gdb_test "print ar1\(3\)" "\\$\[0-9\]+ = 3" \
046f33b
+		"print ar1\(3\)"
046f33b
+
046f33b
+# Tests for subranges of 2 dimensional arrays with subrange variations
046f33b
+gdb_test "print ar2\(2:3, 3:4\)" \
046f33b
+		"\\$\[0-9\]+ = \\(\\( 23, 33\\) \\( 24, 34\\) \\)" \
046f33b
+		"print ar2\(2:3, 3:4\)."
046f33b
+gdb_test "print ar2\(8:9,8:\)" \
046f33b
+		"\\$\[0-9\]+ = \\(\\( 88, 98\\) \\( 89, 99\\) \\)" \
046f33b
+		"print ar2\(8:9,8:\)"
046f33b
+gdb_test "print ar2\(8:9,:2\)" \
046f33b
+		"\\$\[0-9\]+ = \\(\\( 81, 91\\) \\( 82, 92\\) \\)" \
046f33b
+		"print ar2\(8:9,:2\)"
046f33b
+
046f33b
+gdb_test "print ar2\(8:,8:9\)" \
046f33b
+		"\\$\[0-9\]+ = \\(\\( 88, 98\\) \\( 89, 99\\) \\)" \
046f33b
+		"print ar2\(8:,8:9\)"
046f33b
+gdb_test "print ar2\(8:,8:\)" \
046f33b
+		"\\$\[0-9\]+ = \\(\\( 88, 98\\) \\( 89, 99\\) \\)" \
046f33b
+		"print ar2\(8:,8:\)"
046f33b
+gdb_test "print ar2\(8:,:2\)" \
046f33b
+		"\\$\[0-9\]+ = \\(\\( 81, 91\\) \\( 82, 92\\) \\)" \
046f33b
+		"print ar2\(8:,:2\)"
046f33b
+
046f33b
+gdb_test "print ar2\(:2,2:3\)" \
046f33b
+		"\\$\[0-9\]+ = \\(\\( 12, 22\\) \\( 13, 23\\) \\)" \
046f33b
+		"print ar2\(:2,2:3\)"
046f33b
+gdb_test "print ar2\(:2,8:\)" \
046f33b
+		"\\$\[0-9\]+ = \\(\\( 18, 28\\) \\( 19, 29\\) \\)" \
046f33b
+		"print ar2\(:2,8:\)"
046f33b
+gdb_test "print ar2\(:2,:2\)" \
046f33b
+		"\\$\[0-9\]+ = \\(\\( 11, 21\\) \\( 12, 22\\) \\)" \
046f33b
+		"print ar2\(:2,:2\)"
046f33b
+
046f33b
+# Test subranges of 2 dimensional arrays with literals and subrange variations
046f33b
+gdb_test "print ar2\(7, 3:6\)" \
046f33b
+		"\\$\[0-9\]+ = \\(73, 74, 75, 76\\)" \
046f33b
+		"print ar2\(7, 3:6\)"
046f33b
+gdb_test "print ar2\(7,8:\)" \
046f33b
+		"\\$\[0-9\]+ = \\(78, 79\\)" \
046f33b
+		"print ar2\(7,8:\)"
046f33b
+gdb_test "print ar2\(7,:2\)" \
046f33b
+		"\\$\[0-9\]+ = \\(71, 72\\)" \
046f33b
+		"print ar2\(7,:2\)"
046f33b
+
046f33b
+gdb_test "print ar2\(7:8,4\)" \
046f33b
+		"\\$\[0-9\]+ = \\(74, 84\\)" \
046f33b
+		"print ar2(7:8,4\)"
046f33b
+gdb_test "print ar2\(8:,4\)" \
046f33b
+		"\\$\[0-9\]+ = \\(84, 94\\)" \
046f33b
+		"print ar2\(8:,4\)"
046f33b
+gdb_test "print ar2\(:2,4\)" \
046f33b
+		"\\$\[0-9\]+ = \\(14, 24\\)" \
046f33b
+		"print ar2\(:2,4\)"
046f33b
+gdb_test "print ar2\(3,4\)" \
046f33b
+		"\\$\[0-9\]+ = 34" \
046f33b
+		"print ar2\(3,4\)"
046f33b
+
046f33b
+# Test subarrays of 3 dimensional arrays with literals and subrange variations
046f33b
+gdb_test "print ar3\(2:4,3:4,7:8\)" \
fdbd5e3
+		"\\$\[0-9\]+ = \\(\\( \\( 237, 337, 437\\) \\( 247, 347, 447\\)\
fdbd5e3
+		 \\) \\( \\( 238, 338, 438\\) \\( 248, 348, 448\\) \\) \\)" \
046f33b
+		"print ar3\(2:4,3:4,7:8\)"
046f33b
+gdb_test "print ar3\(2:3,4:5,8:\)" \
fdbd5e3
+		"\\$\[0-9\]+ = \\(\\( \\( 248, 348\\) \\( 258, 358\\) \\) \\(\
fdbd5e3
+		 \\( 249, 349\\) \\( 259, 359\\) \\) \\)" \
046f33b
+		"print ar3\(2:3,4:5,8:\)"
046f33b
+gdb_test "print ar3\(2:3,4:5,:2\)" \
fdbd5e3
+		"\\$\[0-9\]+ = \\(\\( \\( 241, 341\\) \\( 251, 351\\) \\) \\(\
fdbd5e3
+		 \\( 242, 342\\) \\( 252, 352\\) \\) \\)" \
046f33b
+		"print ar3\(2:3,4:5,:2\)"
046f33b
+
046f33b
+gdb_test "print ar3\(2:3,8:,7:8\)" \
fdbd5e3
+		"\\$\[0-9\]+ = \\(\\( \\( 287, 387\\) \\( 297, 397\\) \\) \\(\
fdbd5e3
+		 \\( 288, 388\\) \\( 298, 398\\) \\) \\)" \
046f33b
+		"print ar3\(2:3,8:,7:8\)"
046f33b
+gdb_test "print ar3\(2:3,8:,8:\)" \
fdbd5e3
+		"\\$\[0-9\]+ = \\(\\( \\( 288, 388\\) \\( 298, 398\\) \\) \\(\
fdbd5e3
+		 \\( 289, 389\\) \\( 299, 399\\) \\) \\)" \
046f33b
+		"print ar3\(2:3,8:,8:\)"
046f33b
+gdb_test "print ar3\(2:3,8:,:2\)" \
fdbd5e3
+		"\\$\[0-9\]+ = \\(\\( \\( 281, 381\\) \\( 291, 391\\) \\) \\(\
fdbd5e3
+		 \\( 282, 382\\) \\( 292, 392\\) \\) \\)" \
046f33b
+		"print ar3\(2:3,8:,:2\)"
046f33b
+
046f33b
+gdb_test "print ar3\(2:3,:2,7:8\)" \
fdbd5e3
+		"\\$\[0-9\]+ = \\(\\( \\( 217, 317\\) \\( 227, 327\\) \\) \\(\
fdbd5e3
+		 \\( 218, 318\\) \\( 228, 328\\) \\) \\)" \
046f33b
+		"print ar3\(2:3,:2,7:8\)"
046f33b
+gdb_test "print ar3\(2:3,:2,8:\)" \
fdbd5e3
+		"\\$\[0-9\]+ = \\(\\( \\( 218, 318\\) \\( 228, 328\\) \\) \\(\
fdbd5e3
+		 \\( 219, 319\\) \\( 229, 329\\) \\) \\)" \
046f33b
+		"print ar3\(2:3,:2,8:\)"
046f33b
+gdb_test "print ar3\(2:3,:2,:2\)" \
fdbd5e3
+		"\\$\[0-9\]+ = \\(\\( \\( 211, 311\\) \\( 221, 321\\) \\) \\(\
fdbd5e3
+		 \\( 212, 312\\) \\( 222, 322\\) \\) \\)" \
046f33b
+		"print ar3\(2:3,:2,:2\)"
046f33b
+
046f33b
+gdb_test "print ar3\(8:,3:4,7:8\)" \
fdbd5e3
+		"\\$\[0-9\]+ = \\(\\( \\( 837, 937\\) \\( 847, 947\\) \\) \\(\
fdbd5e3
+		 \\( 838, 938\\) \\( 848, 948\\) \\) \\)" \
046f33b
+		"print ar3\(8:,3:4,7:8\)"
046f33b
+gdb_test "print ar3\(8:,4:5,8:\)" \
fdbd5e3
+		"\\$\[0-9\]+ = \\(\\( \\( 848, 948\\) \\( 858, 958\\) \\) \\(\
fdbd5e3
+		 \\( 849, 949\\) \\( 859, 959\\) \\) \\)" \
046f33b
+		"print ar3\(8:,4:5,8:\)"
046f33b
+gdb_test "print ar3\(8:,4:5,:2\)" \
fdbd5e3
+		"\\$\[0-9\]+ = \\(\\( \\( 841, 941\\) \\( 851, 951\\) \\) \\(\
fdbd5e3
+		 \\( 842, 942\\) \\( 852, 952\\) \\) \\)" \
046f33b
+		"print ar3\(8:,4:5,:2\)"
046f33b
+
046f33b
+gdb_test "print ar3\(8:,8:,7:8\)" \
fdbd5e3
+		"\\$\[0-9\]+ = \\(\\( \\( 887, 987\\) \\( 897, 997\\) \\) \\(\
fdbd5e3
+		 \\( 888, 988\\) \\( 898, 998\\) \\) \\)" \
046f33b
+		"print ar3\(8:,8:,7:8\)"
046f33b
+gdb_test "print ar3\(8:,8:,8:\)" \
fdbd5e3
+		"\\$\[0-9\]+ = \\(\\( \\( 888, 988\\) \\( 898, 998\\) \\) \\(\
fdbd5e3
+		 \\( 889, 989\\) \\( 899, 999\\) \\) \\)" \
046f33b
+		"print ar3\(8:,8:,8:\)"
046f33b
+gdb_test "print ar3\(8:,8:,:2\)" \
fdbd5e3
+		"\\$\[0-9\]+ = \\(\\( \\( 881, 981\\) \\( 891, 991\\) \\) \\(\
fdbd5e3
+		 \\( 882, 982\\) \\( 892, 992\\) \\) \\)" \
046f33b
+		"print ar3\(8:,8:,:2\)"
046f33b
+
046f33b
+gdb_test "print ar3\(8:,:2,7:8\)" \
fdbd5e3
+		"\\$\[0-9\]+ = \\(\\( \\( 817, 917\\) \\( 827, 927\\) \\) \\(\
fdbd5e3
+		 \\( 818, 918\\) \\( 828, 928\\) \\) \\)" \
046f33b
+		"print ar3\(8:,:2,7:8\)"
046f33b
+gdb_test "print ar3\(8:,:2,8:\)" \
fdbd5e3
+		"\\$\[0-9\]+ = \\(\\( \\( 818, 918\\) \\( 828, 928\\) \\) \\(\
fdbd5e3
+		 \\( 819, 919\\) \\( 829, 929\\) \\) \\)" \
046f33b
+		"print ar3\(8:,:2,8:\)"
046f33b
+gdb_test "print ar3\(8:,:2,:2\)" \
fdbd5e3
+		"\\$\[0-9\]+ = \\(\\( \\( 811, 911\\) \\( 821, 921\\) \\) \\(\
fdbd5e3
+		 \\( 812, 912\\) \\( 822, 922\\) \\) \\)" \
046f33b
+		"print ar3\(8:,:2,:2\)"
046f33b
+
046f33b
+
046f33b
+gdb_test "print ar3\(:2,3:4,7:8\)" \
fdbd5e3
+		"\\$\[0-9\]+ = \\(\\( \\( 137, 237\\) \\( 147, 247\\) \\) \\(\
fdbd5e3
+		 \\( 138, 238\\) \\( 148, 248\\) \\) \\)" \
046f33b
+		"print ar3 \(:2,3:4,7:8\)."
046f33b
+gdb_test "print ar3\(:2,3:4,8:\)" \
fdbd5e3
+		"\\$\[0-9\]+ = \\(\\( \\( 138, 238\\) \\( 148, 248\\) \\) \\(\
fdbd5e3
+		 \\( 139, 239\\) \\( 149, 249\\) \\) \\)" \
046f33b
+		"print ar3\(:2,3:4,8:\)"
046f33b
+gdb_test "print ar3\(:2,3:4,:2\)" \
fdbd5e3
+		"\\$\[0-9\]+ = \\(\\( \\( 131, 231\\) \\( 141, 241\\) \\) \\(\
fdbd5e3
+		 \\( 132, 232\\) \\( 142, 242\\) \\) \\)" \
046f33b
+		"print ar3\(:2,3:4,:2\)"
046f33b
+
fdbd5e3
+gdb_test "print ar3\(:2,8:,7:8\)" "\\$\[0-9\]+ = \\(\\( \\( 187, 287\\) \\(\
fdbd5e3
+		 197, 297\\) \\) \\( \\( 188, 288\\) \\( 198, 298\\) \\) \\)" \
046f33b
+		"print ar3\(:2,8:,7:8\)"
fdbd5e3
+gdb_test "print ar3\(:2,8:,8:\)" "\\$\[0-9\]+ = \\(\\( \\( 188, 288\\) \\( 198,\
fdbd5e3
+		 298\\) \\) \\( \\( 189, 289\\) \\( 199, 299\\) \\) \\)" \
046f33b
+		"print ar3\(:2,8:,8:\)"
fdbd5e3
+gdb_test "print ar3\(:2,8:,:2\)" "\\$\[0-9\]+ = \\(\\( \\( 181, 281\\) \\( 191,\
fdbd5e3
+		 291\\) \\) \\( \\( 182, 282\\) \\( 192, 292\\) \\) \\)" \
046f33b
+		"print ar3\(:2,8:,:2\)"
046f33b
+
046f33b
+gdb_test "print ar3\(:2,:2,7:8\)" \
fdbd5e3
+		"\\$\[0-9\]+ = \\(\\( \\( 117, 217\\) \\( 127, 227\\) \\) \\(\
fdbd5e3
+		 \\( 118, 218\\) \\( 128, 228\\) \\) \\)" \
046f33b
+		"print ar3\(:2,:2,7:8\)"
046f33b
+gdb_test "print ar3\(:2,:2,8:\)" \
fdbd5e3
+		"\\$\[0-9\]+ = \\(\\( \\( 118, 218\\) \\( 128, 228\\) \\) \\(\
fdbd5e3
+		 \\( 119, 219\\) \\( 129, 229\\) \\) \\)" \
046f33b
+		"print ar3\(:2,:2,8:\)"
046f33b
+gdb_test "print ar3\(:2,:2,:2\)" \
fdbd5e3
+		"\\$\[0-9\]+ = \\(\\( \\( 111, 211\\) \\( 121, 221\\) \\) \\(\
fdbd5e3
+		 \\( 112, 212\\) \\( 122, 222\\) \\) \\)" \
046f33b
+		"print ar3\(:2,:2,:2\)"
046f33b
+
046f33b
+#Tests for subarrays of 3 dimensional arrays with literals and subranges
046f33b
+gdb_test "print ar3\(3,3:4,7:8\)" \
046f33b
+		"\\$\[0-9\]+ = \\(\\( 337, 347\\) \\( 338, 348\\) \\)" \
046f33b
+		"print ar3\(3,3:4,7:8\)"
046f33b
+gdb_test "print ar3\(3,4:5,8:\)" \
046f33b
+		"\\$\[0-9\]+ = \\(\\( 348, 358\\) \\( 349, 359\\) \\)" \
046f33b
+		"print ar3\(3,4:5,8:\)"
046f33b
+gdb_test "print ar3\(3,4:5,:2\)" \
046f33b
+		"\\$\[0-9\]+ = \\(\\( 341, 351\\) \\( 342, 352\\) \\)" \
046f33b
+		"print ar3\(3,4:5,:2\)"
046f33b
+gdb_test "print ar3\(3,4:5,3\)" \
046f33b
+		"\\$\[0-9\]+ = \\(343, 353\\)" \
046f33b
+		"print ar3\(3,4:5,3\)"
046f33b
+
046f33b
+gdb_test "print ar3\(2,8:,7:8\)" \
046f33b
+		"\\$\[0-9\]+ = \\(\\( 287, 297\\) \\( 288, 298\\) \\)" \
046f33b
+		"print ar3\(2,8:,7:8\)"
046f33b
+gdb_test "print ar3\(2,8:,8:\)" \
046f33b
+		"\\$\[0-9\]+ = \\(\\( 288, 298\\) \\( 289, 299\\) \\)" \
046f33b
+		"print ar3\(2,8:,8:\)"
046f33b
+gdb_test "print ar3\(2,8:,:2\)"\
046f33b
+		"\\$\[0-9\]+ = \\(\\( 281, 291\\) \\( 282, 292\\) \\)" \
046f33b
+		"print ar3\(2,8:,:2\)"
046f33b
+gdb_test "print ar3\(2,8:,3\)" \
046f33b
+		"\\$\[0-9\]+ = \\(283, 293\\)" \
046f33b
+		"print ar3\(2,8:,3\)"
046f33b
+
046f33b
+gdb_test "print ar3\(2,:2,7:8\)" \
046f33b
+		"\\$\[0-9\]+ = \\(\\( 217, 227\\) \\( 218, 228\\) \\)" \
046f33b
+		"print ar3\(2,:2,7:8\)"
046f33b
+gdb_test "print ar3\(2,:2,8:\)" \
046f33b
+		"\\$\[0-9\]+ = \\(\\( 218, 228\\) \\( 219, 229\\) \\)" \
046f33b
+		"print ar3\(2,:2,8:\)"
046f33b
+gdb_test "print ar3\(2,:2,:2\)" \
046f33b
+		"\\$\[0-9\]+ = \\(\\( 211, 221\\) \\( 212, 222\\) \\)" \
046f33b
+		"print ar3\(2,:2,:2\)"
046f33b
+gdb_test "print ar3\(2,:2,3\)" \
046f33b
+		"\\$\[0-9\]+ = \\(213, 223\\)" \
046f33b
+		"print ar3\(2,:2,3\)"
046f33b
+
046f33b
+gdb_test "print ar3\(3,4,7:8\)" \
046f33b
+		"\\$\[0-9\]+ = \\(347, 348\\)" \
046f33b
+		"print ar3\(3,4,7:8\)"
046f33b
+gdb_test "print ar3\(3,4,8:\)" \
046f33b
+		"\\$\[0-9\]+ = \\(348, 349\\)" \
046f33b
+i		"print ar3\(3,4,8:\)"
046f33b
+gdb_test "print ar3\(3,4,:2\)" \
046f33b
+		"\\$\[0-9\]+ = \\(341, 342\\)" \
046f33b
+		"print ar3\(3,4,:2\)"
046f33b
+gdb_test "print ar3\(5,6,7\)" \
046f33b
+		"\\$\[0-9\]+ = 567" \
046f33b
+		"print ar3\(5,6,7\)"
046f33b
+
046f33b
+gdb_test "print ar3\(3:4,6,7:8\)" \
046f33b
+		"\\$\[0-9\]+ = \\(\\( 367, 467\\) \\( 368, 468\\) \\)" \
046f33b
+		"print ar3\(3:4,6,7:8\)"
046f33b
+gdb_test "print ar3\(3:4,6,8:\)" \
046f33b
+		"\\$\[0-9\]+ = \\(\\( 368, 468\\) \\( 369, 469\\) \\)" \
046f33b
+		"print ar3\(3:4,6,8:\)"
046f33b
+gdb_test "print ar3\(3:4,6,:2\)" \
046f33b
+		"\\$\[0-9\]+ = \\(\\( 361, 461\\) \\( 362, 462\\) \\)" \
046f33b
+		"print ar3\(3:4,6,:2\)"
046f33b
+gdb_test "print ar3\(3:4,6,5\)" \
046f33b
+		"\\$\[0-9\]+ = \\(365, 465\\)" \
046f33b
+		"print ar3\(3:4,6,5\)"
046f33b
+
046f33b
+gdb_test "print ar3\(8:,6,7:8\)" \
046f33b
+		"\\$\[0-9\]+ = \\(\\( 867, 967\\) \\( 868, 968\\) \\)" \
046f33b
+		"print ar3\(8:,6,7:8\)"
046f33b
+gdb_test "print ar3\(8:,6,8:\)" \
046f33b
+		"\\$\[0-9\]+ = \\(\\( 868, 968\\) \\( 869, 969\\) \\)" \
046f33b
+		"print ar3\(8:,6,8:\)"
046f33b
+gdb_test "print ar3\(8:,6,:2\)" \
046f33b
+		"\\$\[0-9\]+ = \\(\\( 861, 961\\) \\( 862, 962\\) \\)" \
046f33b
+		"print ar3\(8:,6,:2\)"
046f33b
+gdb_test "print ar3\(8:,6,5\)" \
046f33b
+		"\\$\[0-9\]+ = \\(865, 965\\)" \
046f33b
+		"print ar3\(8:,6,5\)"
046f33b
+
046f33b
+gdb_test "print ar3\(:2,6,7:8\)" \
046f33b
+		"\\$\[0-9\]+ = \\(\\( 167, 267\\) \\( 168, 268\\) \\)" \
046f33b
+		"print ar3\(:2,6,7:8\)"
046f33b
+gdb_test "print ar3\(:2,6,8:\)" \
046f33b
+		"\\$\[0-9\]+ = \\(\\( 168, 268\\) \\( 169, 269\\) \\)" \
046f33b
+		"print ar3\(:2,6,8:\)"
046f33b
+gdb_test "print ar3\(:2,6,:2\)" \
046f33b
+		"\\$\[0-9\]+ = \\(\\( 161, 261\\) \\( 162, 262\\) \\)" \
046f33b
+		"print ar3\(:2,6,:2\)"
046f33b
+gdb_test "print ar3\(:2,6,5\)" \
046f33b
+		"\\$\[0-9\]+ = \\(165, 265\\)" \
046f33b
+		"print ar3\(:2,6,5\)"
046f33b
+
046f33b
+gdb_test "print ar3\(3:4,5:6,4\)" \
046f33b
+		"\\$\[0-9\]+ = \\(\\( 354, 454\\) \\( 364, 464\\) \\)" \
046f33b
+		"print ar2\(3:4,5:6,4\)"
046f33b
+gdb_test "print ar3\(8:,5:6,4\)" \
046f33b
+		"\\$\[0-9\]+ = \\(\\( 854, 954\\) \\( 864, 964\\) \\)" \
046f33b
+		"print ar2\(8:,5:6,4\)"
046f33b
+gdb_test "print ar3\(:2,5:6,4\)" \
046f33b
+		"\\$\[0-9\]+ = \\(\\( 154, 254\\) \\( 164, 264\\) \\)" \
046f33b
+		"print ar2\(:2,5:6,4\)"
046f33b
+
046f33b
+# Stride > 1
046f33b
+gdb_test "print ar1\(2:6:2\)" \
046f33b
+		"\\$\[0-9\]+ = \\(2, 4, 6\\)" \
046f33b
+		"print ar1\(2:6:2\)"
046f33b
+gdb_test "print ar2\(2:6:2,3:4\)" \
046f33b
+		"\\$\[0-9\]+ = \\(\\( 23, 43, 63\\) \\( 24, 44, 64\\) \\)" \
046f33b
+		"print ar2\(2:6:2,3:4\)"
046f33b
+gdb_test "print ar2\(2:6:2,3\)" \
046f33b
+		"\\$\[0-9\]+ = \\(23, 43, 63\\)" \
046f33b
+		"print ar2\(2:6:2,3\)"
046f33b
+gdb_test "print ar3\(2:6:2,3:5:2,4:7:3\)" \
fdbd5e3
+		"\\$\[0-9\]+ = \\(\\( \\( 234, 434, 634\\) \\( 254, 454, 654\\)\
fdbd5e3
+		 \\) \\( \\( 237, 437, 637\\) \\( 257, 457, 657\\) \\) \\)" \
046f33b
+		"print ar3\(2:6:2,3:5:2,4:7:3\)"
046f33b
+gdb_test "print ar3\(2:6:2,5,4:7:3\)" \
fdbd5e3
+		"\\$\[0-9\]+ = \\(\\( 254, 454, 654\\) \\( 257, 457, 657\\)\
fdbd5e3
+		 \\)" \
046f33b
+		"print ar3\(2:6:2,5,4:7:3\)"
046f33b
+
046f33b
+# Stride < 0
046f33b
+gdb_test "print ar1\(8:2:-2\)" \
046f33b
+		"\\$\[0-9\]+ = \\(8, 6, 4, 2\\)" \
046f33b
+		"print ar1\(8:2:-2\)"
046f33b
+gdb_test "print ar2\(8:2:-2,3:4\)" \
fdbd5e3
+		"\\$\[0-9\]+ = \\(\\( 83, 63, 43, 23\\) \\( 84, 64, 44, 24\\)\
fdbd5e3
+		 \\)" \
046f33b
+		"print ar2\(8:2:-2,3:4\)"
046f33b
+gdb_test "print ar2\(2:6:2,3\)" \
046f33b
+		"\\$\[0-9\]+ = \\(23, 43, 63\\)" \
046f33b
+		"print ar2\(2:6:2,3\)"
046f33b
+gdb_test "print ar3\(2:3,7:3:-4,4:7:3\)" \
fdbd5e3
+		"\\$\[0-9\]+ = \\(\\( \\( 274, 374\\) \\( 234, 334\\) \\) \\(\
fdbd5e3
+		 \\( 277, 377\\) \\( 237, 337\\) \\) \\)" \
046f33b
+		"print ar3\(2:3,7:3:-4,4:7:3\)"
046f33b
+gdb_test "print ar3\(2:6:2,5,7:4:-3\)" \
fdbd5e3
+		"\\$\[0-9\]+ = \\(\\( 257, 457, 657\\) \\( 254, 454, 654\\)\
fdbd5e3
+		 \\)" \
046f33b
+		"print ar3\(2:6:2,5,7:4:-3\)"
046f33b
+
046f33b
+# Tests with negative and mixed indices
046f33b
+gdb_test "p ar4\(2:4, -2:1, -15:-14\)" \
fdbd5e3
+		"\\$\[0-9\]+ = \\(\\( \\( 261, 361, 461\\) \\( 271, 371, 471\\)\
fdbd5e3
+		 \\( 281, 381, 481\\) \\( 291, 391, 491\\) \\) \\( \\( 262,\
fdbd5e3
+		 362, 462\\) \\( 272, 372, 472\\) \\( 282, 382, 482\\) \\( 292,\
fdbd5e3
+		 392, 492\\) \\) \\)" \
046f33b
+		"print ar4(2:4, -2:1, -15:-14)"
046f33b
+
046f33b
+gdb_test "p ar4\(7,-6:2:3,-7\)" \
046f33b
+                "\\$\[0-9\]+ = \\(729, 759, 789\\)" \
046f33b
+                "print ar4(7,-6:2:3,-7)"
046f33b
+
046f33b
+gdb_test "p ar4\(9:2:-2, -6:2:3, -6:-15:-3\)" \
fdbd5e3
+                "\\$\[0-9\]+ = \\(\\( \\( 930, 730, 530, 330\\) \\( 960, 760,\
fdbd5e3
+		 560, 360\\) \\( 990, 790, 590, 390\\) \\) \\( \\( 927, 727,\
fdbd5e3
+		 527, 327\\) \\( 957, 757, 557, 357\\) \\( 987, 787, 587,\
fdbd5e3
+		 387\\) \\) \\( \\( 924, 724, 524, 324\\) \\( 954, 754, 554,\
fdbd5e3
+		 354\\) \\( 984, 784, 584, 384\\) \\) \\( \\( 921, 721, 521,\
fdbd5e3
+		 321\\) \\( 951, 751, 551, 351\\) \\( 981, 781, 581, 381\\) \\)\
fdbd5e3
+		 \\)" \
046f33b
+                "print ar4(9:2:-2, -6:2:3, -6:-15:-3)"
046f33b
+
046f33b
+gdb_test "p ar4\(:,:,:\)" \
fdbd5e3
+                "\\$\[0-9\]+ = \\(\\( \\( 111, 211, 311, 411, 511, 611, 711,\
fdbd5e3
+		 811, .*" \
046f33b
+                "print ar4(:,:,:)"
046f33b
+
046f33b
+# Provoke error messages for bad user input
046f33b
+gdb_test "print ar1\(0:4\)" \
046f33b
+		"provided bound\\(s\\) outside array bound\\(s\\)" \
046f33b
+		"print ar1\(0:4\)"
046f33b
+gdb_test "print ar1\(8:12\)" \
046f33b
+		"provided bound\\(s\\) outside array bound\\(s\\)" \
046f33b
+		"print ar1\(8:12\)"
046f33b
+gdb_test "print ar1\(8:2:\)" \
046f33b
+		"A syntax error in expression, near `\\)'." \
046f33b
+		"print ar1\(8:2:\)"
046f33b
+gdb_test "print ar1\(8:2:2\)" \
046f33b
+		"Wrong value provided for stride and boundaries" \
046f33b
+		"print ar1\(8:2:2\)"
046f33b
+gdb_test "print ar1\(2:8:-2\)" \
046f33b
+		"Wrong value provided for stride and boundaries" \
046f33b
+		"print ar1\(2:8:-2\)"
046f33b
+gdb_test "print ar1\(2:7:0\)" \
046f33b
+		"Stride must not be 0" \
046f33b
+		"print ar1\(2:7:0\)"
046f33b
+gdb_test "print ar1\(3:7\) = 42" \
046f33b
+		"Invalid cast." \
046f33b
+		"Assignment of value to subarray"
046f33b
diff --git a/gdb/testsuite/gdb.fortran/static-arrays.f90 b/gdb/testsuite/gdb.fortran/static-arrays.f90
046f33b
new file mode 100644
fdbd5e3
index 0000000..f22fcbe
046f33b
--- /dev/null
046f33b
+++ b/gdb/testsuite/gdb.fortran/static-arrays.f90
046f33b
@@ -0,0 +1,55 @@
046f33b
+! Copyright 2015 Free Software Foundation, Inc.
046f33b
+!
046f33b
+! Contributed by Intel Corp. <christoph.t.weinmann@intel.com>
046f33b
+!
046f33b
+! This program is free software; you can redistribute it and/or modify
046f33b
+! it under the terms of the GNU General Public License as published by
046f33b
+! the Free Software Foundation; either version 3 of the License, or
046f33b
+! (at your option) any later version.
046f33b
+!
046f33b
+! This program is distributed in the hope that it will be useful,
046f33b
+! but WITHOUT ANY WARRANTY; without even the implied warranty of
046f33b
+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
046f33b
+! GNU General Public License for more details.
046f33b
+!
046f33b
+! You should have received a copy of the GNU General Public License
046f33b
+! along with this program.  If not, see <http://www.gnu.org/licenses/>.
046f33b
+
046f33b
+subroutine sub
046f33b
+  integer, dimension(9) :: ar1
046f33b
+  integer, dimension(9,9) :: ar2
046f33b
+  integer, dimension(9,9,9) :: ar3
046f33b
+  integer, dimension(10,-7:3, -15:-5) :: ar4
046f33b
+  integer :: i,j,k
046f33b
+
046f33b
+  ar1 = 1
046f33b
+  ar2 = 1
046f33b
+  ar3 = 1
046f33b
+  ar4 = 4
046f33b
+
046f33b
+  ! Resulting array ar3 looks like ((( 111, 112, 113, 114,...)))
046f33b
+  do i = 1, 9, 1
046f33b
+    ar1(i) = i
046f33b
+    do j = 1, 9, 1
046f33b
+      ar2(i,j) = i*10 + j
046f33b
+      do k = 1, 9, 1
046f33b
+        ar3(i,j,k) = i*100 + j*10 + k
046f33b
+      end do
046f33b
+    end do
046f33b
+  end do
046f33b
+
fdbd5e3
+  do i = 1, 10, 1
046f33b
+    do j = -7, 3, 1
046f33b
+      do k = -15, -5, 1
046f33b
+        ar4(i,j,k) = i*100 + (j+8)*10 + (k+16)
046f33b
+      end do
046f33b
+    end do
046f33b
+  end do
046f33b
+
046f33b
+  ar1(1) = 11  !BP1
046f33b
+  return
046f33b
+end
046f33b
+
046f33b
+program testprog
046f33b
+  call sub
046f33b
+end
046f33b
-- 
fdbd5e3
2.5.0
fdbd5e3