public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug tdep/29543] [gdb/tdep, ppc] inferior call with long double vararg not handled correctly
Date: Fri, 02 Sep 2022 15:14:51 +0000	[thread overview]
Message-ID: <bug-29543-4717-fwhuK5FX54@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-29543-4717@http.sourceware.org/bugzilla/>

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ulrich.weigand at de dot ibm.com,
                   |                            |uweigand at sourceware dot org

--- Comment #4 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #3)
> I simplified the example to strip the _Complex, and I still got the same
> problem, so it's really related to "long double".

Looking at that variant, I added the following code:
...
void __attribute__((noinline))
test2 (void)
{
  do_copy (1, orig);
}
...
to get an example how code is generated, and compiled it at -O2 (adding
noinline attributes for all functions) to make it more readable.

I get this:
...
0000000010000210 <test2>:
    10000210:   02 10 40 3c     lis     r2,4098
    10000214:   00 80 42 38     addi    r2,r2,-32768
    10000218:   a6 02 08 7c     mflr    r0
    1000021c:   00 00 00 60     nop
    10000220:   01 00 60 38     li      r3,1
    10000224:   00 80 22 39     addi    r9,r2,-32768
    10000228:   00 00 a9 e8     ld      r5,0(r9)
    1000022c:   08 00 c9 e8     ld      r6,8(r9)
    10000230:   10 00 01 f8     std     r0,16(r1)
    10000234:   a1 ff 21 f8     stdu    r1,-96(r1)
    10000238:   81 ff ff 4b     bl      100001b8 <do_copy+0x8>
    1000023c:   60 00 21 38     addi    r1,r1,96
    10000240:   10 00 01 e8     ld      r0,16(r1)
    10000244:   a6 03 08 7c     mtlr    r0
    10000248:   20 00 80 4e     blr
    1000024c:   00 00 00 00     .long 0x0
    10000250:   00 00 00 01     .long 0x1000000
    10000254:   80 00 00 00     .long 0x80
    10000258:   00 00 00 60     nop
    1000025c:   00 00 42 60     ori     r2,r2,0
...

AFAICT, the first arg is loaded into r3, and the second into r5/r6.

So, for some reason r4 is skipped.

However, when stepping through ppc64_sysv_abi_push_val I find that gdb pushes
the value to r4/r5.  The code in do_copy then proceeds to read it from r5/r6,
and this explains the failure.

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

  parent reply	other threads:[~2022-09-02 15:14 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-02 13:00 [Bug tdep/29543] New: [gdb/tdep] inferior call with complex " vries at gcc dot gnu.org
2022-09-02 13:07 ` [Bug tdep/29543] " vries at gcc dot gnu.org
2022-09-02 13:10 ` [Bug tdep/29543] [gdb/tdep, ppc] " vries at gcc dot gnu.org
2022-09-02 13:16 ` vries at gcc dot gnu.org
2022-09-02 13:26 ` [Bug tdep/29543] [gdb/tdep, ppc] inferior call with " vries at gcc dot gnu.org
2022-09-02 15:14 ` vries at gcc dot gnu.org [this message]
2022-09-04  7:49 ` vries at gcc dot gnu.org
2022-09-04  7:56 ` vries at gcc dot gnu.org
2022-09-05 16:23 ` uweigand at gcc dot gnu.org
2022-09-06  5:44 ` vries at gcc dot gnu.org
2022-09-07 12:10 ` uweigand at gcc dot gnu.org
2022-09-07 13:46 ` vries at gcc dot gnu.org
2022-09-07 15:33 ` cel at us dot ibm.com
2022-09-07 17:16 ` vries at gcc dot gnu.org
2022-09-07 18:22 ` cel at us dot ibm.com
2022-09-12  9:05 ` vries at gcc dot gnu.org
2022-09-16 15:12 ` vries at gcc dot gnu.org
2022-09-16 16:38 ` cel at us dot ibm.com
2022-11-15  0:55 ` cel at us dot ibm.com

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-29543-4717-fwhuK5FX54@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).