public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug testsuite/26997] New: [-m32] FAIL: gdb.fortran/array-slices.exp: repack=on: test 9: check sizes match
@ 2020-12-02 15:18 vries at gcc dot gnu.org
  2020-12-02 15:29 ` [Bug testsuite/26997] " vries at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: vries at gcc dot gnu.org @ 2020-12-02 15:18 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 26997
           Summary: [-m32] FAIL: gdb.fortran/array-slices.exp: repack=on:
                    test 9: check sizes match
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: testsuite
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

In more detail:
...
(gdb) print /x &array4d^M
$69 = 0xffffb640^M
(gdb) PASS: gdb.fortran/array-slices.exp: repack=on: test 9: get hexadecimal
valueof "&array4d"
print /x (&array4d) + sizeof (array4d)^M
$70 = 0x95c640^M
(gdb) PASS: gdb.fortran/array-slices.exp: repack=on: test 9: get hexadecimal
valueof "(&array4d) + sizeof (array4d)"
FAIL: gdb.fortran/array-slices.exp: repack=on: test 9: check sizes match
...

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

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

* [Bug testsuite/26997] [-m32] FAIL: gdb.fortran/array-slices.exp: repack=on: test 9: check sizes match
  2020-12-02 15:18 [Bug testsuite/26997] New: [-m32] FAIL: gdb.fortran/array-slices.exp: repack=on: test 9: check sizes match vries at gcc dot gnu.org
@ 2020-12-02 15:29 ` vries at gcc dot gnu.org
  2020-12-02 18:48 ` vries at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: vries at gcc dot gnu.org @ 2020-12-02 15:29 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
With some additional logging:
....
diff --git a/gdb/testsuite/gdb.fortran/array-slices.exp
b/gdb/testsuite/gdb.fortran/array-s
lices.exp
index ff00fae886..a9a64aaa3f 100644
--- a/gdb/testsuite/gdb.fortran/array-slices.exp
+++ b/gdb/testsuite/gdb.fortran/array-slices.exp
@@ -226,7 +226,9 @@ proc run_test { repack } {
            # sizes when GDB's repacking setting matches the repacking
            # behaviour we got from the compiler.
            if { ($addr_in_show < $start_addr || $addr_in_show >= $end_addr) \
-                == ($repack == "on") } {
+                    == ($repack == "on") } {
+               verbose -log "size_in_show: $size_in_show"
+               verbose -log "size_in_parent: $size_in_parent"
                gdb_assert {$size_in_show == $size_in_parent} \
                    "check sizes match"
            } elseif { $repack == "off" } {
....
we have:
...
size_in_show: 3136
size_in_parent: 16
FAIL: gdb.fortran/array-slices.exp: repack=on: test 9: check sizes match
...

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

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

* [Bug testsuite/26997] [-m32] FAIL: gdb.fortran/array-slices.exp: repack=on: test 9: check sizes match
  2020-12-02 15:18 [Bug testsuite/26997] New: [-m32] FAIL: gdb.fortran/array-slices.exp: repack=on: test 9: check sizes match vries at gcc dot gnu.org
  2020-12-02 15:29 ` [Bug testsuite/26997] " vries at gcc dot gnu.org
@ 2020-12-02 18:48 ` vries at gcc dot gnu.org
  2021-01-08 14:14 ` vries at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: vries at gcc dot gnu.org @ 2020-12-02 18:48 UTC (permalink / raw)
  To: gdb-prs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrew.burgess at embecosm dot com

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

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

* [Bug testsuite/26997] [-m32] FAIL: gdb.fortran/array-slices.exp: repack=on: test 9: check sizes match
  2020-12-02 15:18 [Bug testsuite/26997] New: [-m32] FAIL: gdb.fortran/array-slices.exp: repack=on: test 9: check sizes match vries at gcc dot gnu.org
  2020-12-02 15:29 ` [Bug testsuite/26997] " vries at gcc dot gnu.org
  2020-12-02 18:48 ` vries at gcc dot gnu.org
@ 2021-01-08 14:14 ` vries at gcc dot gnu.org
  2021-01-08 14:17 ` vries at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: vries at gcc dot gnu.org @ 2021-01-08 14:14 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
...
$ gdb -batch outputs/gdb.fortran/array-slices/array-slices \
  -ex "break 66" \
  -ex run \
  -ex "continue 4" \
  -ex up \
  -ex "print /x &array4d" \
  -ex "p /x sizeof (array4d)" \
  -ex "print /x (&array4d) + sizeof (array4d)"
  ...
$1 = 0xffffbe00
$2 = 0xc40
$3 = 0x95ce00
...

So, we expect the last to print 0xffffbe00 + 0xc40 == 0xffffca40, but instead
we get 0x95ce00.

Using this patch, the FAILs are fixed:
...
$ git diff
diff --git a/gdb/testsuite/gdb.fortran/array-slices.exp
b/gdb/testsuite/gdb.fortran/array-slices
.exp
index f45a299b268..3ea17bdf777 100644
--- a/gdb/testsuite/gdb.fortran/array-slices.exp
+++ b/gdb/testsuite/gdb.fortran/array-slices.exp
@@ -208,7 +208,7 @@ proc run_test { repack } {
            set start_addr [get_hexadecimal_valueof "&${full_var_name}" \
                                "start unknown"]
            set end_addr [get_hexadecimal_valueof \
-                             "(&${full_var_name}) + sizeof (${full_var_name})"
\
+                             "(int)(&${full_var_name}) + sizeof
(${full_var_name})" \
                              "end unknown"]

            # The Fortran compiler can choose to either send a descriptor that
...

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

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

* [Bug testsuite/26997] [-m32] FAIL: gdb.fortran/array-slices.exp: repack=on: test 9: check sizes match
  2020-12-02 15:18 [Bug testsuite/26997] New: [-m32] FAIL: gdb.fortran/array-slices.exp: repack=on: test 9: check sizes match vries at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-01-08 14:14 ` vries at gcc dot gnu.org
@ 2021-01-08 14:17 ` vries at gcc dot gnu.org
  2021-01-15 10:04 ` vries at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: vries at gcc dot gnu.org @ 2021-01-08 14:17 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #2)
> Using this patch, the FAILs are fixed:

But I don't understand fortran syntax well enough to decide whether this is a
testsuite problem or a gdb problem.

Andrew, any comment?

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

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

* [Bug testsuite/26997] [-m32] FAIL: gdb.fortran/array-slices.exp: repack=on: test 9: check sizes match
  2020-12-02 15:18 [Bug testsuite/26997] New: [-m32] FAIL: gdb.fortran/array-slices.exp: repack=on: test 9: check sizes match vries at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2021-01-08 14:17 ` vries at gcc dot gnu.org
@ 2021-01-15 10:04 ` vries at gcc dot gnu.org
  2021-01-15 11:14 ` cvs-commit at gcc dot gnu.org
  2021-01-15 11:15 ` vries at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: vries at gcc dot gnu.org @ 2021-01-15 10:04 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #4 from Tom de Vries <vries at gcc dot gnu.org> ---
https://sourceware.org/pipermail/gdb-patches/2021-January/175116.html

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

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

* [Bug testsuite/26997] [-m32] FAIL: gdb.fortran/array-slices.exp: repack=on: test 9: check sizes match
  2020-12-02 15:18 [Bug testsuite/26997] New: [-m32] FAIL: gdb.fortran/array-slices.exp: repack=on: test 9: check sizes match vries at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2021-01-15 10:04 ` vries at gcc dot gnu.org
@ 2021-01-15 11:14 ` cvs-commit at gcc dot gnu.org
  2021-01-15 11:15 ` vries at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-01-15 11:14 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #5 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=10f92414d6d4a5f8eb8cbb2bf39ca86c1f9c1da5

commit 10f92414d6d4a5f8eb8cbb2bf39ca86c1f9c1da5
Author: Tom de Vries <tdevries@suse.de>
Date:   Fri Jan 15 12:14:45 2021 +0100

    [gdb/testsuite] Fix gdb.fortran/array-slices.exp with -m32

    When running test-case gdb.fortran/array-slices.exp with target board
    unix/-m32, we run into:
    ...
    (gdb) print /x &array4d^M
    $69 = 0xffffb620^M
    (gdb) print /x (&array4d) + sizeof (array4d)^M
    $70 = 0x95c620^M
    (gdb) FAIL: gdb.fortran/array-slices.exp: repack=on: test 9: check sizes
match
    ...
    The expressions calculate the start and end of an array, but the
calculation
    of the end expression has an unexpected result (given that it lies before
the
    start of the array).  By printing "sizeof (array4d)" as a separate
    expression:
    ...
    (gdb) print /x sizeof (array4d)
    $1 = 0xc40
    ...
    it becomes clear we expected to get 0xffffb620 + 0xc40 == 0xffffc260
instead.

    The problem is that using the '&' returns a pointer type:
    ...
    (gdb) p &array4d
    $5 = (PTR TO -> ( integer(kind=4) (-3:3,7:10,-3:3,-10:-7) )) 0xffffbe00
    ...
    which has the consequence that the addition is done as pointer arithmetic.

    Fix this by using the result of "print /x &array4d" instead of &array4d in
the
    addition.

    Tested on x86_64-linux.

    gdb/testsuite/ChangeLog:

    2021-01-15  Tom de Vries  <tdevries@suse.de>

            PR testsuite/26997
            * gdb.fortran/array-slices.exp (run_test): Avoid pointer arithmetic
            when adding sizeof.

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

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

* [Bug testsuite/26997] [-m32] FAIL: gdb.fortran/array-slices.exp: repack=on: test 9: check sizes match
  2020-12-02 15:18 [Bug testsuite/26997] New: [-m32] FAIL: gdb.fortran/array-slices.exp: repack=on: test 9: check sizes match vries at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2021-01-15 11:14 ` cvs-commit at gcc dot gnu.org
@ 2021-01-15 11:15 ` vries at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: vries at gcc dot gnu.org @ 2021-01-15 11:15 UTC (permalink / raw)
  To: gdb-prs

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

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

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

--- Comment #6 from Tom de Vries <vries at gcc dot gnu.org> ---
Patch committed, marking resolved-fixed.

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

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

end of thread, other threads:[~2021-01-15 11:15 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-02 15:18 [Bug testsuite/26997] New: [-m32] FAIL: gdb.fortran/array-slices.exp: repack=on: test 9: check sizes match vries at gcc dot gnu.org
2020-12-02 15:29 ` [Bug testsuite/26997] " vries at gcc dot gnu.org
2020-12-02 18:48 ` vries at gcc dot gnu.org
2021-01-08 14:14 ` vries at gcc dot gnu.org
2021-01-08 14:17 ` vries at gcc dot gnu.org
2021-01-15 10:04 ` vries at gcc dot gnu.org
2021-01-15 11:14 ` cvs-commit at gcc dot gnu.org
2021-01-15 11:15 ` 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).