From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11620 invoked by alias); 19 Aug 2014 16:49:58 -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 11611 invoked by uid 89); 19 Aug 2014 16:49:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 19 Aug 2014 16:49:57 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s7JGnrVF008111 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 19 Aug 2014 12:49:54 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s7JGnqB7021062; Tue, 19 Aug 2014 12:49:53 -0400 Message-ID: <53F38030.1020406@redhat.com> Date: Tue, 19 Aug 2014 16:49:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: Doug Evans , gdb-patches@sourceware.org Subject: Re: [RFC] delete gdb.cp/ambiguous.exp ? References: In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit X-SW-Source: 2014-08/txt/msg00353.txt.bz2 On 08/19/2014 12:23 AM, Doug Evans wrote: > Along the lines of dead code removal ... > > What should we do with this testcase? > > The messages it is looking for from gdb do not exist, Hmm. These are: # X is derived from A1 and A2; both A1 and A2 have a member 'x' send_gdb "print x.x\n" gdb_expect { -re "warning: x ambiguous; using X::A2::x. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" { pass "print x.x" } -re "warning: x ambiguous; using X::A1::x. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" { pass "print x.x" } -re ".*$gdb_prompt $" { fail "print x.x" } timeout { fail "(timeout) print x.x" } } Actually enabling the test (removing the skip, and adding nowarnings), we see that indeed GDB outputs no warning: print x.x $1 = 994109222 (gdb) FAIL: gdb.cp/ambiguous.exp: print x.x but, GDB also silently picks an 'x'. If we try compiling 'x.x', we get: ambiguous.cc: In function ‘int main()’: ambiguous.cc:103:67: error: request for member ‘x’ is ambiguous i += k.i + m.w + a1.x + a2.x + a3.x + x.z + l.z + n.r + j.j + x.x; ^ ambiguous.cc:15:7: note: candidates are: int A2::x int x; ^ ambiguous.cc:9:7: note: int A1::x And gdb.cp/inherit.exp has: # Print all members of g_D. # # g_D.A::a and g_D.A::x are ambiguous member accesses. gdb_test "print g_D.A::a" "base class 'A' is ambiguous in type 'D'" So shouldn't GDB error out in the 'x.x' case too ? Or at least warn, like the test suggests (I bet this came in with the big HP merge years ago). In this case below, GDB does error out, though the test expects a warning: print (A1)j base class 'A1' is ambiguous in type 'J' (gdb) FAIL: gdb.cp/ambiguous.exp: print (A1)j Running /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.cp/ambiguous.exp ... FAIL: gdb.cp/ambiguous.exp: print x.x FAIL: gdb.cp/ambiguous.exp: print n.x FAIL: gdb.cp/ambiguous.exp: print j.x FAIL: gdb.cp/ambiguous.exp: print jva1.x FAIL: gdb.cp/ambiguous.exp: print jva2.x FAIL: gdb.cp/ambiguous.exp: print (A1)j FAIL: gdb.cp/ambiguous.exp: print (A1)jva1 -- Thanks, Pedro Alves