91 lines
3.3 KiB
Diff
91 lines
3.3 KiB
Diff
From 3f323125c4c8d9c4c00cb8941149ac36443dac26 Mon Sep 17 00:00:00 2001
|
|
From: Jan Kratochvil <jan.kratochvil@redhat.com>
|
|
Date: Fri, 18 Feb 2011 00:17:35 +0100
|
|
Subject: [PATCH 1/2] Fix subranges bug http://sourceware.org/bugzilla/show_bug.cgi?id=9395#c5
|
|
reported by Joachim Protze.
|
|
|
|
---
|
|
gdb/eval.c | 1 +
|
|
gdb/testsuite/gdb.fortran/subrange.exp | 31 ++++++++++++++++++++-----------
|
|
gdb/testsuite/gdb.fortran/subrange.f90 | 7 ++++++-
|
|
3 files changed, 27 insertions(+), 12 deletions(-)
|
|
|
|
diff --git a/gdb/eval.c b/gdb/eval.c
|
|
index f21ae38..6f37f2c 100644
|
|
--- a/gdb/eval.c
|
|
+++ b/gdb/eval.c
|
|
@@ -563,6 +563,7 @@ value_f90_subarray (struct value *array, struct expression *exp, int *pos,
|
|
value_byte_address = (TYPE_DATA_LOCATION_ADDR (type)
|
|
+ value_offset (array));
|
|
TYPE_DATA_LOCATION_IS_ADDR (type) = 0;
|
|
+ TYPE_DATA_LOCATION_DWARF_BLOCK (type) = NULL;
|
|
}
|
|
else
|
|
value_byte_address = value_address (array);
|
|
diff --git a/gdb/testsuite/gdb.fortran/subrange.exp b/gdb/testsuite/gdb.fortran/subrange.exp
|
|
index 55598f9..be372c1 100644
|
|
--- a/gdb/testsuite/gdb.fortran/subrange.exp
|
|
+++ b/gdb/testsuite/gdb.fortran/subrange.exp
|
|
@@ -34,17 +34,26 @@ set int4 "(int4|integer\\(kind=4\\))"
|
|
gdb_breakpoint [gdb_get_line_number "break-static"]
|
|
gdb_continue_to_breakpoint "break-static" ".*break-static.*"
|
|
|
|
-gdb_test "p a (2, 2:3)" { = \(22, 32\)}
|
|
-gdb_test "p a (2:3, 3)" { = \(32, 33\)}
|
|
-gdb_test "p a (1, 2:)" { = \(21, 31\)}
|
|
-gdb_test "p a (2, :2)" { = \(12, 22\)}
|
|
-gdb_test "p a (3, 2:2)" { = \(23\)}
|
|
-gdb_test "ptype a (3, 2:2)" " = $int4 \\(2:2\\)"
|
|
-gdb_test "p a (4, :)" { = \(14, 24, 34\)}
|
|
-gdb_test "p a (:, :)" { = \(\( *11, 12, 13, 14\) \( *21, 22, 23, 24\) \( *31, 32, 33, 34\) *\)}
|
|
-gdb_test "ptype a (:, :)" " = $int4 \\(4,3\\)"
|
|
-gdb_test "p a (:)" "Wrong number of subscripts"
|
|
-gdb_test "p a (:, :, :)" "Wrong number of subscripts"
|
|
+foreach var {a alloc ptr} {
|
|
+ global pf_prefix
|
|
+ set old_prefix $pf_prefix
|
|
+ lappend pf_prefix "$var:"
|
|
+
|
|
+ gdb_test "p $var (2, 2:3)" { = \(22, 32\)}
|
|
+ gdb_test "p $var (2:3, 3)" { = \(32, 33\)}
|
|
+ gdb_test "p $var (1, 2:)" { = \(21, 31\)}
|
|
+ gdb_test "p $var (2, :2)" { = \(12, 22\)}
|
|
+ gdb_test "p $var (3, 2:2)" { = \(23\)}
|
|
+ gdb_test "ptype $var (3, 2:2)" " = $int4 \\(2:2\\)"
|
|
+ gdb_test "p $var (4, :)" { = \(14, 24, 34\)}
|
|
+ gdb_test "p $var (:, :)" { = \(\( *11, 12, 13, 14\) \( *21, 22, 23, 24\) \( *31, 32, 33, 34\) *\)}
|
|
+ gdb_test "ptype $var (:, :)" " = $int4 \\(4,3\\)"
|
|
+ gdb_test "p $var (:)" "Wrong number of subscripts"
|
|
+ gdb_test "p $var (:, :, :)" "Wrong number of subscripts"
|
|
+
|
|
+ set pf_prefix $old_prefix
|
|
+}
|
|
+
|
|
gdb_test_no_output {set $a=a}
|
|
delete_breakpoints
|
|
gdb_unload
|
|
diff --git a/gdb/testsuite/gdb.fortran/subrange.f90 b/gdb/testsuite/gdb.fortran/subrange.f90
|
|
index fe33c2c..4747ea9 100644
|
|
--- a/gdb/testsuite/gdb.fortran/subrange.f90
|
|
+++ b/gdb/testsuite/gdb.fortran/subrange.f90
|
|
@@ -14,10 +14,15 @@
|
|
! along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
program test
|
|
- integer :: a (4, 3)
|
|
+ integer, target :: a (4, 3)
|
|
+ integer, allocatable :: alloc (:, :)
|
|
+ integer, pointer :: ptr (:, :)
|
|
do 1 i = 1, 4
|
|
do 1 j = 1, 3
|
|
a (i, j) = j * 10 + i
|
|
1 continue
|
|
+ allocate (alloc (4, 3))
|
|
+ alloc = a
|
|
+ ptr => a
|
|
write (*,*) a ! break-static
|
|
end
|
|
--
|
|
1.7.4
|
|
|