public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/31015] New: [gdb, ppc64le] FAIL: gdb.ada/array_return.exp: value printed by finish of Create_Small_Float_Vector
@ 2023-10-31  9:37 vries at gcc dot gnu.org
  2023-10-31 15:32 ` [Bug gdb/31015] " vries at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2023-10-31  9:37 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31015

            Bug ID: 31015
           Summary: [gdb, ppc64le] FAIL: gdb.ada/array_return.exp: value
                    printed by finish of Create_Small_Float_Vector
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

On AlmaLinux 9.2 ppc64le I get:
...
(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
/home/vries/gdb/binutils-gdb.git/gdb/testsuite/gdb.ada/array_return/pck.adb:30^M
0x00000000100022d4 in p () at
/home/vries/gdb/binutils-gdb.git/gdb/testsuite/gdb.ada/array_return/p.adb:25^M
25         Vector := Create_Small_Float_Vector;^M
Value returned is $3 = (2.80259693e-45, 2.80259693e-45)^M
(gdb) FAIL: gdb.ada/array_return.exp: value printed by finish of
Create_Small_Float_Vector
...

A passing case looks like:
...
(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
/data/vries/gdb/binutils-gdb.git/gdb/testsuite/gdb.ada/array_return/pck.adb:30^M
0x00000000004020bd in p () at
/data/vries/gdb/binutils-gdb.git/gdb/testsuite/gdb.ada/array_return/p.adb:25^M
25         Vector := Create_Small_Float_Vector;^M
Value returned is $3 = (4.25, 4.25)^M
...

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug gdb/31015] [gdb, ppc64le] FAIL: gdb.ada/array_return.exp: value printed by finish of Create_Small_Float_Vector
  2023-10-31  9:37 [Bug gdb/31015] New: [gdb, ppc64le] FAIL: gdb.ada/array_return.exp: value printed by finish of Create_Small_Float_Vector vries at gcc dot gnu.org
@ 2023-10-31 15:32 ` vries at gcc dot gnu.org
  2023-10-31 15:35 ` [Bug tdep/31015] " vries at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2023-10-31 15:32 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31015

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
Tentative patch:
...
diff --git a/gdb/ppc-sysv-tdep.c b/gdb/ppc-sysv-tdep.c
index 20e732ff162..494c3e3df17 100644
--- a/gdb/ppc-sysv-tdep.c
+++ b/gdb/ppc-sysv-tdep.c
@@ -1127,7 +1127,10 @@ ppc64_aggregate_candidate (struct type *type,

          if (!get_array_bounds (type, &low_bound, &high_bound))
            return -1;
-         count *= high_bound - low_bound;
+         LONGEST nr_array_elements = (low_bound > high_bound ?
+                                      0
+                                      : (high_bound - low_bound + 1));
+         count *= nr_array_elements;

          /* There must be no padding.  */
          if (count == 0)
...

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug tdep/31015] [gdb, ppc64le] FAIL: gdb.ada/array_return.exp: value printed by finish of Create_Small_Float_Vector
  2023-10-31  9:37 [Bug gdb/31015] New: [gdb, ppc64le] FAIL: gdb.ada/array_return.exp: value printed by finish of Create_Small_Float_Vector vries at gcc dot gnu.org
  2023-10-31 15:32 ` [Bug gdb/31015] " vries at gcc dot gnu.org
@ 2023-10-31 15:35 ` vries at gcc dot gnu.org
  2023-11-01  7:49 ` vries at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2023-10-31 15:35 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31015

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|gdb                         |tdep

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug tdep/31015] [gdb, ppc64le] FAIL: gdb.ada/array_return.exp: value printed by finish of Create_Small_Float_Vector
  2023-10-31  9:37 [Bug gdb/31015] New: [gdb, ppc64le] FAIL: gdb.ada/array_return.exp: value printed by finish of Create_Small_Float_Vector vries at gcc dot gnu.org
  2023-10-31 15:32 ` [Bug gdb/31015] " vries at gcc dot gnu.org
  2023-10-31 15:35 ` [Bug tdep/31015] " vries at gcc dot gnu.org
@ 2023-11-01  7:49 ` vries at gcc dot gnu.org
  2023-11-02 18:04 ` cvs-commit at gcc dot gnu.org
  2023-11-02 18:07 ` vries at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2023-11-01  7:49 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31015

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
https://sourceware.org/pipermail/gdb-patches/2023-November/203693.html

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug tdep/31015] [gdb, ppc64le] FAIL: gdb.ada/array_return.exp: value printed by finish of Create_Small_Float_Vector
  2023-10-31  9:37 [Bug gdb/31015] New: [gdb, ppc64le] FAIL: gdb.ada/array_return.exp: value printed by finish of Create_Small_Float_Vector vries at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2023-11-01  7:49 ` vries at gcc dot gnu.org
@ 2023-11-02 18:04 ` cvs-commit at gcc dot gnu.org
  2023-11-02 18:07 ` vries at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-11-02 18:04 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31015

--- Comment #3 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom de Vries <vries@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=cb9045becc6b76b9d7a257ad7e98d853fe8f7acb

commit cb9045becc6b76b9d7a257ad7e98d853fe8f7acb
Author: Tom de Vries <tdevries@suse.de>
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 := Create_Small_Float_Vector;^M
    Value returned is $3 = (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 = (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 *= 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 = 1
    (gdb) p high_bound
    $2 = 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 = (low_bound > high_bound
                                           ? 0
                                           : (high_bound - low_bound + 1));
              count *= nr_array_elements;
    ...

    Tested on powerpc64le-linux.

    Approved-By: Ulrich Weigand <uweigand@de.ibm.com>

    PR tdep/31015
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31015

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug tdep/31015] [gdb, ppc64le] FAIL: gdb.ada/array_return.exp: value printed by finish of Create_Small_Float_Vector
  2023-10-31  9:37 [Bug gdb/31015] New: [gdb, ppc64le] FAIL: gdb.ada/array_return.exp: value printed by finish of Create_Small_Float_Vector vries at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2023-11-02 18:04 ` cvs-commit at gcc dot gnu.org
@ 2023-11-02 18:07 ` vries at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2023-11-02 18:07 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31015

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
   Target Milestone|---                         |15.1
         Resolution|---                         |FIXED

--- Comment #4 from Tom de Vries <vries at gcc dot gnu.org> ---
Fixed.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-11-02 18:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-31  9:37 [Bug gdb/31015] New: [gdb, ppc64le] FAIL: gdb.ada/array_return.exp: value printed by finish of Create_Small_Float_Vector vries at gcc dot gnu.org
2023-10-31 15:32 ` [Bug gdb/31015] " vries at gcc dot gnu.org
2023-10-31 15:35 ` [Bug tdep/31015] " vries at gcc dot gnu.org
2023-11-01  7:49 ` vries at gcc dot gnu.org
2023-11-02 18:04 ` cvs-commit at gcc dot gnu.org
2023-11-02 18:07 ` vries at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).