From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 847043939C2D; Thu, 11 Jun 2020 12:34:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 847043939C2D From: "cvs-commit at gcc dot gnu.org" To: gdb-prs@sourceware.org Subject: [Bug gdb/21356] value.c:828: internal-error: int value_contents_bits_eq(const value*, int, const value*, int, int): Assertion `offset1 + length <= TYPE_LENGTH (val1->enclosing_type) * TARGET_CHAR_BIT' failed Date: Thu, 11 Jun 2020 12:34:48 +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: 7.12.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: keiths at redhat dot com 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: Thu, 11 Jun 2020 12:34:48 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D21356 --- Comment #4 from cvs-commit at gcc dot gnu.org --- The master branch has been updated by Tom de Vries : https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D2f33032a93f2= 4ccc0c0d2f23e2a3ec0442f638d4 commit 2f33032a93f24ccc0c0d2f23e2a3ec0442f638d4 Author: Keith Seitz Date: Thu Jun 11 14:34:44 2020 +0200 Compute proper length for dynamic types of TYPE_CODE_TYPEDEF This patch fixes gdb/21356 in which we hit an assertion in value_contents_bits_eq: (gdb) p container_object2 (gdb) p container_object2 $1 =3D {_container_member2 =3D 15, _vla_struct_object2 =3D {_some_membe= r =3D 0, _vla_field =3D { ../../src/gdb/value.c:829: internal-error: \ int value_contents_bits_eq(const value*, int, const value*, int, int)= : \ Assertion `offset1 + length \ <=3D TYPE_LENGTH (val1->enclosing_type) * TARGET_CHAR_BIT' failed. This is happening because TYPE_LENGTH (val1->enclosing_type) is erroneo= usly based on enclosing_type, which is a typedef, instead of the actual underlying type. This can be traced back to resolve_dynamic_struct, where the size of the type is computed: ... TYPE_FIELD_TYPE (resolved_type, i) =3D resolve_dynamic_type_internal (TYPE_FIELD_TYPE (resolved_= type, i), &pinfo, 0); gdb_assert (TYPE_FIELD_LOC_KIND (resolved_type, i) =3D=3D FIELD_LOC_KIND_BITPOS); new_bit_length =3D TYPE_FIELD_BITPOS (resolved_type, i); if (TYPE_FIELD_BITSIZE (resolved_type, i) !=3D 0) new_bit_length +=3D TYPE_FIELD_BITSIZE (resolved_type, i); else new_bit_length +=3D (TYPE_LENGTH (TYPE_FIELD_TYPE (resolved_t= ype, i)) * TARGET_CHAR_BIT); ... In this function, resolved_type is TYPE_CODE_TYPEDEF which is not what = we want to use to calculate the size of the actual field. This patch fixes this and the similar problem in resolve_dynamic_union. gdb/ChangeLog: 2020-06-11 Keith Seitz PR gdb/21356 * gdbtypes.c (resolve_dynamic_union, resolve_dynamic_struct): Resolve typedefs for type length calculations. gdb/testsuite/ChangeLog: 2020-06-11 Keith Seitz PR gdb/21356 * gdb.base/vla-datatypes.c (vla_factory): Add typedef for struct vla_struct. Add new struct vla_typedef and union vla_typedef_union and corresponding instantiation objects. Initialize new objects. * gdb.base/vla-datatypes.exp: Add tests for vla_typedef_struct_object and vla_typedef_union_object. Fixup type for vla_struct_object. --=20 You are receiving this mail because: You are on the CC list for the bug.=