Re: [PATCH] gdb/testsuite: Fix typos in infcall-nested-structs.c

Tom de Vries
2019-10-11T12:19:07Z

On 10-10-2019 23:07, Tom de Vries wrote:
> On 10-10-2019 22:26, Tom de Vries wrote:
>> 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.
>>
>
> I've simplified the test-case a bit further, and filed as:
> https://sourceware.org/bugzilla/show_bug.cgi?id=25096.
>

I've submitted a fix for PR24104 (
https://sourceware.org/ml/gdb-patches/2019-10/msg00293.html ) which
marks these 3 FAILs as KFAILs.

Thanks,
- Tom