From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 45605 invoked by alias); 10 Oct 2019 20:26:41 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 45596 invoked by uid 89); 10 Oct 2019 20:26:41 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-12.9 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mx1.suse.de Received: from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 10 Oct 2019 20:26:40 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 07F78AC6E; Thu, 10 Oct 2019 20:26:38 +0000 (UTC) Subject: Re: [PATCH] gdb/testsuite: Fix typos in infcall-nested-structs.c From: Tom de Vries To: Andreas Arnez Cc: Tom Tromey , gdb-patches@sourceware.org, Alan Hayward , Andrew Burgess References: <87lfttdcmv.fsf@tromey.com> <7004ea74-1aeb-112c-ee24-a0042423e0a4@suse.de> <286c7f7a-e53d-5d52-8ca7-a48a79778f0a@suse.de> Message-ID: <7f0bcf92-cdbe-c44f-9f67-d2610bddef76@suse.de> Date: Thu, 10 Oct 2019 20:26:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1 MIME-Version: 1.0 In-Reply-To: <286c7f7a-e53d-5d52-8ca7-a48a79778f0a@suse.de> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2019-10/txt/msg00287.txt.bz2 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