From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 17EBC3840C03; Fri, 20 Nov 2020 22:25:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 17EBC3840C03 From: "simark at simark dot ca" To: gdb-prs@sourceware.org Subject: [Bug exp/26875] Incorrect value printed for address of first element of zero-length array Date: Fri, 20 Nov 2020 22:25:12 +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: simark at simark dot ca 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: Fri, 20 Nov 2020 22:25:12 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D26875 --- Comment #12 from Simon Marchi --- (In reply to Tom de Vries from comment #11) > (In reply to Simon Marchi from comment #7) > > I am not able to reproduce. In my version of the compiled test case, b= oth > > bounds are const: > >=20 > > (top-gdb) p type->bounds ()->low.kind () > > $4 =3D PROP_CONST > > (top-gdb) p type->bounds ()->high.kind () > > $5 =3D PROP_CONST > >=20 > > What compiler do you use to build the test case? >=20 > Gcc 7.5.0 Thanks, I see the failure with gcc 7. > > So I presume GDB translates that to two constant bounds with value 0. = What > > does it look like in yours? > >=20 > > I stumbled on a similar problem and filed this bug here, they are likely > > related: > >=20 > > https://sourceware.org/bugzilla/show_bug.cgi?id=3D26901 > >=20 > > I have this patch series in the pipeline that I made to address 26901: > >=20 > > https://review.lttng.org/c/binutils-gdb/+/4399/4 > >=20 >=20 > Ah, thanks for the pointer, I'll take a look. The patches are not commented at all now, but the idea is to be able to fet= ch the low and high bounds separately, not all or nothing like it is now. Her= e, we only care about the low bound, so we only get that one, and ignore the h= igh bound (which is unknown). >=20 > > If/when I am able to reproduce this (26875) bug, I can check if that he= lps > > with it too. >=20 > That would be great. The failure goes away with these patches applied. The only thing that bugs me is that some part of the code assumes that a bo= und of "-1" means an unknown bound. It seems to me that if we use gdb::optiona= l, we don't need that: an empty optional means an unknown bound. So we would = need to go through all the users to see we if need the "set to -1" vs "empty optional" disctinction or not. --=20 You are receiving this mail because: You are on the CC list for the bug.=