From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28210 invoked by alias); 17 Feb 2011 23:46:51 -0000 Mailing-List: contact archer-commits-help@sourceware.org; run by ezmlm Sender: Precedence: bulk List-Post: List-Help: List-Subscribe: Received: (qmail 28181 invoked by uid 9674); 17 Feb 2011 23:46:50 -0000 Date: Thu, 17 Feb 2011 23:46:00 -0000 Message-ID: <20110217234650.28166.qmail@sourceware.org> From: jkratoch@sourceware.org To: archer-commits@sourceware.org Subject: [SCM] archer-jankratochvil-vla: Fix the remaining two FAILing subrange testcases. X-Git-Refname: refs/heads/archer-jankratochvil-vla X-Git-Reftype: branch X-Git-Oldrev: d5e40d825b0eb90b9a8219a68920064e4295f65c X-Git-Newrev: 678cbb7340d8edfa92ce6de931d8d4e9c3b86c06 X-SW-Source: 2011-q1/txt/msg00135.txt.bz2 List-Id: The branch, archer-jankratochvil-vla has been updated via 678cbb7340d8edfa92ce6de931d8d4e9c3b86c06 (commit) via 3f323125c4c8d9c4c00cb8941149ac36443dac26 (commit) from d5e40d825b0eb90b9a8219a68920064e4295f65c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 678cbb7340d8edfa92ce6de931d8d4e9c3b86c06 Author: Jan Kratochvil Date: Fri Feb 18 00:46:12 2011 +0100 Fix the remaining two FAILing subrange testcases. commit 3f323125c4c8d9c4c00cb8941149ac36443dac26 Author: Jan Kratochvil Date: Fri Feb 18 00:17:35 2011 +0100 Fix subranges bug http://sourceware.org/bugzilla/show_bug.cgi?id=9395#c5 reported by Joachim Protze. ----------------------------------------------------------------------- Summary of changes: gdb/dwarf2read.c | 14 ++++++++------ gdb/eval.c | 6 +++++- gdb/testsuite/gdb.fortran/subrange.exp | 31 ++++++++++++++++++++----------- gdb/testsuite/gdb.fortran/subrange.f90 | 7 ++++++- 4 files changed, 39 insertions(+), 19 deletions(-) First 500 lines of diff: diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 89d15d1..a9099be 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -7416,6 +7416,14 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu) for (i = ndim - 1; i >= 0; i--) type = create_single_array_dimension (type, range_types[i], die, cu); + /* Data locations should be set only for the outermost dimension as they + would be confusing for the dereferenced offset on the inner ones. */ + attr = dwarf2_attr (die, DW_AT_data_location, cu); + if (attr_form_is_block (attr)) + TYPE_DATA_LOCATION_DWARF_BLOCK (type) + = dwarf2_attr_to_locexpr_baton (attr, cu); + gdb_assert (!TYPE_DATA_LOCATION_IS_ADDR (type)); + /* Understand Dwarf2 support for vector types (like they occur on the PowerPC w/ AltiVec). Gcc just adds another attribute to the array type. This is not part of the Dwarf2/3 standard yet, but a @@ -15072,12 +15080,6 @@ fetch_die_type_attrs (struct die_info *die, struct type *type, { struct attribute *attr; - attr = dwarf2_attr (die, DW_AT_data_location, cu); - if (attr_form_is_block (attr)) - TYPE_DATA_LOCATION_DWARF_BLOCK (type) = dwarf2_attr_to_locexpr_baton (attr, - cu); - gdb_assert (!TYPE_DATA_LOCATION_IS_ADDR (type)); - attr = dwarf2_attr (die, DW_AT_allocated, cu); if (attr_form_is_block (attr)) TYPE_ALLOCATED (type) = dwarf2_attr_to_locexpr_baton (attr, cu); diff --git a/gdb/eval.c b/gdb/eval.c index f21ae38..f4ccc89 100644 --- a/gdb/eval.c +++ b/gdb/eval.c @@ -563,9 +563,13 @@ 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); + { + gdb_assert (TYPE_DATA_LOCATION_DWARF_BLOCK (type) == NULL); + value_byte_address = value_address (array); + } new_array_type = type; 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 . 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 hooks/post-receive -- Repository for Project Archer.