public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: Andreas Arnez <arnez@linux.ibm.com>
Cc: Tom Tromey <tom@tromey.com>,
	gdb-patches@sourceware.org, Alan Hayward <alan.hayward@arm.com>,
	Andrew Burgess <andrew.burgess@embecosm.com>
Subject: Re: [PATCH] gdb/testsuite: Fix typos in infcall-nested-structs.c
Date: Thu, 10 Oct 2019 20:26:00 -0000	[thread overview]
Message-ID: <7f0bcf92-cdbe-c44f-9f67-d2610bddef76@suse.de> (raw)
In-Reply-To: <286c7f7a-e53d-5d52-8ca7-a48a79778f0a@suse.de>

On 10-10-2019 20:30, Tom de Vries wrote:
> On 10-10-2019 19:24, Andreas Arnez wrote:
>> On Thu, Oct 10 2019, Tom de Vries wrote:
>>
>>> I see these new failures on x86_64-linux:
>>> ...
>>> FAIL: gdb.base/infcall-nested-structs.exp: l=c++: types-tc-tf: p/d
>>> check_arg_struct_02_01 (ref_val_struct_02_01)
>>> FAIL: gdb.base/infcall-nested-structs.exp: l=c++: types-ts-tf: p/d
>>> check_arg_struct_02_01 (ref_val_struct_02_01)
>>> FAIL: gdb.base/infcall-nested-structs.exp: l=c++: types-ti-tf: p/d
>>> check_arg_struct_02_01 (ref_val_struct_02_01)
>>> ...
>>
>> Maybe the test case caught a real bug then, right?  Or do you see a
>> problem with the test case?
> 
> I think it's a real bug.
> 
> I've minimized the types-ti-tf FAIL to:
> ...
> $ cat test.c
> typedef int ti;
> typedef float tf;
> struct struct_02_01
> {
>   struct { } es1;
>   struct {
>     struct {
>       ti a;
>       tf b;
>     } s1;
>   } s2;
> };
> 
> struct struct_02_01 ref_val_struct_02_01 = {
>   {},
>   {
>     {
>       'a',
>       'b'
>     }
>   }
> };
> 
> int cmp_struct_02_01 (struct struct_02_01 a, struct struct_02_01 b)
> { return a.s2.s1.a == b.s2.s1.a && a.s2.s1.b == b.s2.s1.b; }
> 
> int
> check_arg_struct_02_01 (struct struct_02_01 arg) {
>   return cmp_struct_02_01 (arg, ref_val_struct_02_01);
> }
> 
> int
> main (void)
> {
>   return check_arg_struct_02_01 (ref_val_struct_02_01);
> }
> $ g++ test.c -g
> $ ./a.out; echo $?
> 1
> $ gdb a.out -batch -ex start -ex "p check_arg_struct_02_01
> (ref_val_struct_02_01)"
> Temporary breakpoint 1 at 0x400563: file test.c, line 35.
> 
> Temporary breakpoint 1, main () at test.c:35
> 35        return check_arg_struct_02_01 (ref_val_struct_02_01);
> $1 = 0
> ...
> 

The discrepancy is that the code generated by gcc passes the struct in
registers %rdi and %xmm0, but amd64_push_arguments classifies the struct as:
...
(gdb) p theclass
$57 = {AMD64_INTEGER, AMD64_INTEGER}
...
and therefore passes it in %rdi and %rsi.

Thanks,
- Tom

  reply	other threads:[~2019-10-10 20:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-08 11:25 Andreas Arnez
2019-10-09 17:58 ` Tom Tromey
2019-10-10 10:29   ` Andreas Arnez
2019-10-10 15:23     ` Tom de Vries
2019-10-10 17:24       ` Andreas Arnez
2019-10-10 18:30         ` Tom de Vries
2019-10-10 20:26           ` Tom de Vries [this message]
2019-10-10 21:07             ` Tom de Vries
2019-10-11 12:19               ` Tom de Vries
2019-10-12 11:49                 ` [PATCH][gdb/tdep] Fix inferior call arg passing for amd64 Tom de Vries

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=7f0bcf92-cdbe-c44f-9f67-d2610bddef76@suse.de \
    --to=tdevries@suse.de \
    --cc=alan.hayward@arm.com \
    --cc=andrew.burgess@embecosm.com \
    --cc=arnez@linux.ibm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.com \
    /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).