[Bug tdep/29543] [gdb/tdep, ppc] inferior call with long double vararg not handled correctly

vries at gcc dot gnu.org sourceware-bugzilla@sourceware.org
Fri Sep 2 15:14:51 GMT 2022


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.


More information about the Gdb-prs mailing list