public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug testsuite/26997] [-m32] FAIL: gdb.fortran/array-slices.exp: repack=on: test 9: check sizes match
Date: Fri, 15 Jan 2021 11:14:49 +0000	[thread overview]
Message-ID: <bug-26997-4717-MDHyJTsZ6i@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-26997-4717@http.sourceware.org/bugzilla/>

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.

  parent reply	other threads:[~2021-01-15 11:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-02 15:18 [Bug testsuite/26997] New: " 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 [this message]
2021-01-15 11:15 ` vries at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-26997-4717-MDHyJTsZ6i@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).