From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 930783855014; Sun, 27 Jun 2021 18:00:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 930783855014 From: "ahmedsayeed1982 at yahoo dot com" To: gdb-prs@sourceware.org Subject: [Bug gdb/26901] Array subscript fails with flexible array member without size Date: Sun, 27 Jun 2021 18:00:22 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: gdb X-Bugzilla-Version: 10.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: ahmedsayeed1982 at yahoo dot com X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: FIXED X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: 10.2 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc 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: Sun, 27 Jun 2021 18:00:22 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D26901 Ahmed Sayeed changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ahmedsayeed1982 at yahoo d= ot com --- Comment #6 from Ahmed Sayeed --- This failure was introduced by commit 7c6f27129631 ("gdb: make get_discrete_bounds check for non-constant range bounds"). Unfortunately, = this commit doesn't build, but it's trivial to fix if you want to try it: just remove the parenthesis after `kind` that it introduces. val_subscript passes the array's index type (of type code TYPE_CODE_RANGE) = to get_discrete_bounds. The index type has the low bound set to constant 0 and the high bound unknown. Before the commit, get_discrete_bounds would return "success" and set the low and high bound to 0. Although it's a bit by chan= ce that it returned 0 for the high bound, since the bound was "unknown". It doesn't really matter in that case because the high bound doesn't get used = by the caller. After the commit, the new check in get_discrete_bounds sees that the high b= ound isn't a constant, so returns "failure". However, val_subscript doesn't che= ck the return value, and uses the uninitialized values of low and high bounds,= and it goes downhill from there. http://mirei.xyz/ --=20 You are receiving this mail because: You are on the CC list for the bug.=