From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id hbHwCe6JNmqfxxAAWB0awg (envelope-from ) for ; Sat, 20 Jun 2026 08:39:10 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=I9Rq8aVi; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=YJNlFzvX; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=I9Rq8aVi; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=YJNlFzvX; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 162E71E0A3; Sat, 20 Jun 2026 08:39:10 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id C63481E024 for ; Sat, 20 Jun 2026 08:39:08 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7EA804BB1C06 for ; Sat, 20 Jun 2026 12:39:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7EA804BB1C06 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=I9Rq8aVi; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=YJNlFzvX; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=I9Rq8aVi; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=YJNlFzvX Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2a07:de40:b251:101:10:150:64:2]) by sourceware.org (Postfix) with ESMTPS id DD6084BB1C01 for ; Sat, 20 Jun 2026 12:38:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DD6084BB1C01 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org DD6084BB1C01 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=2a07:de40:b251:101:10:150:64:2 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1781959084; cv=none; b=aMtG+ZZqkT8RCG4XTeNV97m1Paaerfu7Br1g69keU5ogOpBVZfKxdSUJg0ijKWJYD2BLtbyer9cgp98Z7H3bh7JzK53bb8zD6pa3CVv8IgM0BBh+51uTCQq5Xvo6sA2SILAEYMcIHmvRwRMe3g+o5ICUFYJ+WwP43nkxHfF3rFI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1781959084; c=relaxed/simple; bh=N4SewgkNPJvT2H1X6Qq7TjwAwuRyRhOFCw4xkY3z0Ps=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature: Message-ID:Date:MIME-Version:Subject:To:From; b=uZJ5yt/ftBKg4HvVRef/sjAksGii2PUjOkVq+pP62GRo/Yg8hLUrFq3xnQp/95rikDc/p7YWEJycMgu5BRyyY6FDcCRFqW9aaF7+/xdSeKum3aSv++vXB9QAfTkxG217HyLWVk+z8P4owAAlH30EozsjegNZfKMQsxufYXPUzPw= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=I9Rq8aVi; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=YJNlFzvX; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=I9Rq8aVi; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=YJNlFzvX DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DD6084BB1C01 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 8D0AC75DE9; Sat, 20 Jun 2026 12:38:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1781959081; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ppUPGeebG65rCn56HJpih+TK5ljR6CLeX7vm+MEgnac=; b=I9Rq8aViNw2zeA4VHTcTqQsJhE+tAOEQsoQNumsa0Nyi1YBFnupO64eEO4MvbNgTQcN8he rizMHgjAnhdSKi+8rBu1TmfCZRPa8ZCH3ghvtylNoSzL393fhibucdmI5tU/GQbhcBe22j h8lMzsSHAuKVd7INqT0hKEL17MYCppE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1781959081; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ppUPGeebG65rCn56HJpih+TK5ljR6CLeX7vm+MEgnac=; b=YJNlFzvXm6yonBon561iFXEdgt7t5AN0RgINb6BZPR35FQL2lz2FpZvlSS8P4wxZ61m9t7 Nu4LS2AURc0po7Bg== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1781959081; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ppUPGeebG65rCn56HJpih+TK5ljR6CLeX7vm+MEgnac=; b=I9Rq8aViNw2zeA4VHTcTqQsJhE+tAOEQsoQNumsa0Nyi1YBFnupO64eEO4MvbNgTQcN8he rizMHgjAnhdSKi+8rBu1TmfCZRPa8ZCH3ghvtylNoSzL393fhibucdmI5tU/GQbhcBe22j h8lMzsSHAuKVd7INqT0hKEL17MYCppE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1781959081; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ppUPGeebG65rCn56HJpih+TK5ljR6CLeX7vm+MEgnac=; b=YJNlFzvXm6yonBon561iFXEdgt7t5AN0RgINb6BZPR35FQL2lz2FpZvlSS8P4wxZ61m9t7 Nu4LS2AURc0po7Bg== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 75435779A8; Sat, 20 Jun 2026 12:38:01 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id IDA8G6mJNmofdwAAD6G6ig (envelope-from ); Sat, 20 Jun 2026 12:38:01 +0000 Message-ID: <33826fc0-b2ab-444e-8fc3-d293f4f7a9e7@suse.de> Date: Sat, 20 Jun 2026 14:38:01 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] Printing of Fortran arrays with dynamic elements To: Tom Tromey , gdb-patches@sourceware.org References: <20260619214227.1998085-1-tom@tromey.com> Content-Language: en-US From: Tom de Vries In-Reply-To: <20260619214227.1998085-1-tom@tromey.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spamd-Result: default: False [-4.30 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCVD_VIA_SMTP_AUTH(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; MID_RHS_MATCH_FROM(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email, suse.de:mid, imap1.dmz-prg2.suse.org:helo] X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org On 6/19/26 11:42 PM, Tom Tromey wrote: > This bug points out a case where a Fortran array has dynamic elements, > and each element must have its dynamic type resolved separately. > > I took the test case directly from the bug, figuring it was ok as the > author is at AMD and has some tags in the repository already. > LGTM. Reviewed-By: Tom de Vries Thanks, - Tom > Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=34276 > --- > gdb/f-array-walker.h | 9 +++-- > .../gdb.fortran/dynamic-elements.exp | 37 +++++++++++++++++++ > .../gdb.fortran/dynamic-elements.f90 | 34 +++++++++++++++++ > 3 files changed, 77 insertions(+), 3 deletions(-) > create mode 100644 gdb/testsuite/gdb.fortran/dynamic-elements.exp > create mode 100644 gdb/testsuite/gdb.fortran/dynamic-elements.f90 > > diff --git a/gdb/f-array-walker.h b/gdb/f-array-walker.h > index bb8cb0ca599..4392e54013b 100644 > --- a/gdb/f-array-walker.h > +++ b/gdb/f-array-walker.h > @@ -267,13 +267,16 @@ class fortran_array_walker > { > LONGEST elt_off = offset + calc.index_offset (i); > > - if (is_dynamic_type (elt_type)) > + struct type *this_elt_type = elt_type; > + if (is_dynamic_type (this_elt_type)) > { > CORE_ADDR e_address = m_address + elt_off; > - elt_type = resolve_dynamic_type (elt_type, {}, e_address); > + this_elt_type = resolve_dynamic_type (this_elt_type, {}, > + e_address); > } > > - m_impl.process_element (elt_type, elt_off, i, i == upperbound); > + m_impl.process_element (this_elt_type, elt_off, i, > + i == upperbound); > } > } > > diff --git a/gdb/testsuite/gdb.fortran/dynamic-elements.exp b/gdb/testsuite/gdb.fortran/dynamic-elements.exp > new file mode 100644 > index 00000000000..4a83ad09438 > --- /dev/null > +++ b/gdb/testsuite/gdb.fortran/dynamic-elements.exp > @@ -0,0 +1,37 @@ > +# Copyright 2026 Free Software Foundation, Inc. > + > +# This program is free software; you can redistribute it and/or modify > +# it under the terms of the GNU General Public License as published by > +# the Free Software Foundation; either version 3 of the License, or > +# (at your option) any later version. > +# > +# This program is distributed in the hope that it will be useful, > +# but WITHOUT ANY WARRANTY; without even the implied warranty of > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > +# GNU General Public License for more details. > +# > +# You should have received a copy of the GNU General Public License > +# along with this program. If not, see . > + > +# Test where an array has elements of dynamic type, where each element > +# is different. > + > +require allow_fortran_tests > + > +standard_testfile .f90 > +load_lib "fortran.exp" > + > +if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \ > + {debug f90}]} { > + return > +} > + > +if {![fortran_runto_main]} { > + return > +} > + > +gdb_breakpoint [gdb_get_line_number "stop"] > +gdb_continue_to_breakpoint "stop" > + > +gdb_test "print keys" \ > + [quotemeta "@DECIMAL = (( f = (1, 2) ), ( f = (3, 4, 5) ))"] > diff --git a/gdb/testsuite/gdb.fortran/dynamic-elements.f90 b/gdb/testsuite/gdb.fortran/dynamic-elements.f90 > new file mode 100644 > index 00000000000..61a2b6edb3c > --- /dev/null > +++ b/gdb/testsuite/gdb.fortran/dynamic-elements.f90 > @@ -0,0 +1,34 @@ > +! Copyright 2026 Free Software Foundation, Inc. > +! > +! This program is free software; you can redistribute it and/or modify > +! it under the terms of the GNU General Public License as published by > +! the Free Software Foundation; either version 3 of the License, or > +! (at your option) any later version. > +! > +! This program is distributed in the hope that it will be useful, > +! but WITHOUT ANY WARRANTY; without even the implied warranty of > +! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > +! GNU General Public License for more details. > +! > +! You should have received a copy of the GNU General Public License > +! along with this program. If not, see . > + > +program test > + implicit none > + > + type :: arr > + integer, allocatable :: f (:) > + end type > + > + type(arr), dimension(2) :: keys > + allocate (keys(1)%f(2)) > + allocate (keys(2)%f(3)) > + keys(1)%f(1) = 1 > + keys(1)%f(2) = 2 > + keys(2)%f(1) = 3 > + keys(2)%f(2) = 4 > + keys(2)%f(3) = 5 > + print *, keys(1)%f(1) ! stop > + print *, keys(2)%f(1) > + > +end program test