From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E4DB5385AE67; Tue, 14 Jun 2022 14:51:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E4DB5385AE67 From: "vries at gcc dot gnu.org" To: gdb-prs@sourceware.org Subject: [Bug tdep/29247] [gdb, tdep] ../../gdb/ppc-sysv-tdep.c:1945: internal-error: ppc64_sysv_abi_return_value: Assertion `ok' failed Date: Tue, 14 Jun 2022 14:51:31 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: tdep X-Bugzilla-Version: 12.1 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: 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: Tue, 14 Jun 2022 14:51:32 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D29247 Tom de Vries changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kevinb at sourceware dot o= rg --- Comment #1 from Tom de Vries --- I had problems reproducing this, so I write an all-arch selftest: ... diff --git a/gdb/gdbarch-selftests.c b/gdb/gdbarch-selftests.c index 198346bddec..8b6b4c708ab 100644 --- a/gdb/gdbarch-selftests.c +++ b/gdb/gdbarch-selftests.c @@ -122,6 +122,19 @@ register_to_value_test (struct gdbarch *gdbarch) } } +static void +blabla (struct gdbarch *gdbarch) +{ + struct type *t =3D builtin_type (gdbarch)->builtin_long_double; + struct type *c =3D init_complex_type ("complex long double", t); + struct type *f =3D lookup_function_type (c); + struct value *v + =3D allocate_value_lazy (f); + + gdbarch_return_value (gdbarch, v, c, nullptr, nullptr, nullptr); +} + } // namespace selftests void _initialize_gdbarch_selftests (); @@ -130,4 +143,6 @@ _initialize_gdbarch_selftests () { selftests::register_test_foreach_arch ("register_to_value", selftests::register_to_value_test); + selftests::register_test_foreach_arch ("blabla", + selftests::blabla); } ... And then downgraded the ok asserts in ppc64_sysv_abi_return_value to errors, which can be caught: ... diff --git a/gdb/ppc-sysv-tdep.c b/gdb/ppc-sysv-tdep.c index 6c2fd1bfc99..c0bfd8bcbbd 100644 --- a/gdb/ppc-sysv-tdep.c +++ b/gdb/ppc-sysv-tdep.c @@ -1942,7 +1942,9 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch , struct value *function, { ok =3D ppc64_sysv_abi_return_value_base (gdbarch, eltype, regcach= e, readbuf, writebuf, i); - gdb_assert (ok); + if (!ok) + error ("ppc64_sysv_abi_return_value problem"); + if (readbuf) readbuf +=3D TYPE_LENGTH (eltype); @@ -1968,7 +1970,8 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch , struct value *function, { ok =3D ppc64_sysv_abi_return_value_base (gdbarch, eltype, regcach= e, readbuf, writebuf, i); - gdb_assert (ok); + if (!ok) + error ("ppc64_sysv_abi_return_value problem"); if (readbuf) readbuf +=3D TYPE_LENGTH (eltype); @@ -2024,7 +2027,8 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch , struct value *function, { ok =3D ppc64_sysv_abi_return_value_base (gdbarch, eltype, regcach= e, readbuf, writebuf, i); - gdb_assert (ok); + if (!ok) + error ("ppc64_sysv_abi_return_value problem"); if (readbuf) readbuf +=3D TYPE_LENGTH (eltype); ... I get fails only for the powerpc architecture: ... $ ./gdb.sh -q -batch -ex "maint selftest blabla" 2>&1 | grep -B1 failed Running selftest blabla::powerpc:620. Self test failed: ppc64_sysv_abi_return_value problem Running selftest blabla::powerpc:630. Self test failed: ppc64_sysv_abi_return_value problem -- Running selftest blabla::powerpc:a35. Self test failed: ppc64_sysv_abi_return_value problem -- Running selftest blabla::powerpc:common64. Self test failed: ppc64_sysv_abi_return_value problem -- Running selftest blabla::powerpc:rs64ii. Self test failed: ppc64_sysv_abi_return_value problem Running selftest blabla::powerpc:rs64iii. Self test failed: ppc64_sysv_abi_return_value problem -- Running selftest blabla::z80n. Ran 355 unit tests, 6 failed ... By debugging and comparing with a passing instance, I narrowed down the difference to: ... /* IBM long double stored in two consecutive FPRs. */ if (TYPE_LENGTH (valtype) =3D=3D 16 && valtype->code () =3D=3D TYPE_CODE_FLT && (gdbarch_long_double_format (gdbarch) =3D=3D floatformats_ibm_long_double)) { ... which is triggered in the passing case, but for the selftest fails because: ... (gdb) p gdbarch_long_double_format (gdbarch) $2 =3D (const floatformat **) 0x2707860 ... and then no other case triggers. --=20 You are receiving this mail because: You are on the CC list for the bug.=