From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C0F273858C41; Thu, 2 Nov 2023 18:04:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C0F273858C41 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1698948257; bh=sYjOPm9tPb/HtfrkjRLCslCDuE6M3I9hbLs6HAQR3fk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ChZK7GT3uj0o6N9YuWlET11RUKrHMdtyQPfk4Vy7cGJsLSLshoDJF0aa//te9Pzgf eRAm0zH4xaL3ZkbOUVHJXY3B2pEv0gBat5fwF/wZtDvTjoUsnrLLdRCSDNBK4iPDt5 KT92iWw1MWVLiNQR33jkzjpfENo57a7NWHhLyBns= From: "cvs-commit at gcc dot gnu.org" To: gdb-prs@sourceware.org Subject: [Bug tdep/31015] [gdb, ppc64le] FAIL: gdb.ada/array_return.exp: value printed by finish of Create_Small_Float_Vector Date: Thu, 02 Nov 2023 18:04:17 +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: HEAD 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: 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 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D31015 --- Comment #3 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=3Dcb9045becc6b= 76b9d7a257ad7e98d853fe8f7acb commit cb9045becc6b76b9d7a257ad7e98d853fe8f7acb Author: Tom de Vries Date: Thu Nov 2 19:05:21 2023 +0100 [gdb/tdep] Fix nr array elements in ppc64_aggregate_candidate On AlmaLinux 9.2 powerpc64le I run into: ... (gdb) PASS: gdb.ada/array_return.exp: continuing to Create_Small_Float_Vector finish^M Run till exit from #0 pck.create_small_float_vector () at pck.adb:30^M 0x00000000100022d4 in p () at p.adb:25^M 25 Vector :=3D Create_Small_Float_Vector;^M Value returned is $3 =3D (2.80259693e-45, 2.80259693e-45)^M (gdb) FAIL: gdb.ada/array_return.exp: value printed by finish of Create_Small_Float_Vector ... while this is expected: ... Value returned is $3 =3D (4.25, 4.25)^M ... The problem is here in ppc64_aggregate_candidate: ... if (!get_array_bounds (type, &low_bound, &high_bound)) return -1; count *=3D high_bound - low_bound ... The array type (containing 2 elements) is: ... type Small_Float_Vector is array (1 .. 2) of Float; ... so we have: ... (gdb) p low_bound $1 =3D 1 (gdb) p high_bound $2 =3D 2 ... but we calculate the number of elements in the array using "high_bound - low_bound", which is 1. Consequently, gdb fails to correctly classify the type as a ELFv2 homogeneous aggregate. Fix this by calculating the number of elements in the array by using "high_bound - low_bound + 1" instead. Furthermore, high_bound can (in general, though perhaps not here) also = be smaller than low_bound, so to be safe take that into account as well: ... LONGEST nr_array_elements =3D (low_bound > high_bound ? 0 : (high_bound - low_bound + 1)); count *=3D nr_array_elements; ... Tested on powerpc64le-linux. Approved-By: Ulrich Weigand PR tdep/31015 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=3D31015 --=20 You are receiving this mail because: You are on the CC list for the bug.=