From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 97F363861039; Sat, 14 Nov 2020 12:04:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 97F363861039 From: "vries at gcc dot gnu.org" To: gdb-prs@sourceware.org Subject: [Bug exp/26875] Incorrect value printed for address of first element of zero-length array Date: Sat, 14 Nov 2020 12:04:58 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: exp X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: vries at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gdb-prs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-prs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 12:04:58 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D26875 --- Comment #6 from Tom de Vries --- The simplest fix would be to make sure get_discrete_bounds always returns defined *lowp and *highp: ... diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 686edafcf64..9a891e7bfde 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -1043,6 +1043,8 @@ has_static_range (const struct range_bounds *bounds) int get_discrete_bounds (struct type *type, LONGEST *lowp, LONGEST *highp) { + *lowp =3D 0; + *highp =3D -1; type =3D check_typedef (type); switch (type->code ()) { ... which also happens to fix PR26870 - "[fortran] Printing dynamic array fails= ". --=20 You are receiving this mail because: You are on the CC list for the bug.=