From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qv1-xf44.google.com (mail-qv1-xf44.google.com [IPv6:2607:f8b0:4864:20::f44]) by sourceware.org (Postfix) with ESMTPS id 09A9D387089B for ; Thu, 27 Aug 2020 11:25:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 09A9D387089B Received: by mail-qv1-xf44.google.com with SMTP id dd12so2422494qvb.0 for ; Thu, 27 Aug 2020 04:25:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Jc50ydE5rWbB3pQ0HjLuVnKIwAil6Fbd1XwuSjFKPwQ=; b=NWjng9yuzIbzW0jaJQnX5G6+tVuQEZ78wlH0HCm5IwR8HMpAWx1gw2UkM3V17UsiWB Xie70znfRPnjeVCQS5Y9D6l3P3zOWC1euCb3dzRGbzQZb+oAc+rOR5CaS/IcwwgofukL Z4hFdbbeaTSMUGTSJayCuHRCFJKOp16oA5iTYzJUDJcB4mg/YTJKlPpRlWOsM7VUEG04 DIyzHh/sMcPLHPSMD1xcdsDJePXHO+Rly5J1VHUuVI39mU2eeBZj6rmxlMGNj7tUwhzG Ah96Lu8a4wHGxj007JZWClZmu9oi8fEDHA1K4Q7KjejYvrb0x912OeBmReJH5ubBip+/ taXQ== X-Gm-Message-State: AOAM532768OqK5JMeDVpEyiWj3fXgNRMV/gMLkxXM57o7bBIgPH9vUK3 QEFGvpOSaJINymQNK74Sqp4mEtF9Dz1PSQ== X-Google-Smtp-Source: ABdhPJzsj5N/yAaatWSURr2lJ5R0dtP47FnUOCUDA3jhSFU/K2jNrPQSSm8SKQuTIIl+Q2xywKpVhA== X-Received: by 2002:a0c:fa50:: with SMTP id k16mr17561611qvo.132.1598527537059; Thu, 27 Aug 2020 04:25:37 -0700 (PDT) Received: from ?IPv6:2804:7f0:8283:a3ee:1908:8b5e:50f8:c881? ([2804:7f0:8283:a3ee:1908:8b5e:50f8:c881]) by smtp.gmail.com with ESMTPSA id h13sm1520793qtu.7.2020.08.27.04.25.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 27 Aug 2020 04:25:36 -0700 (PDT) Subject: Re: [PATCH v2] Enable gdb.cp/ambiguous.exp with GCC and clang To: Pedro Alves , Gary Benson Cc: gdb-patches@sourceware.org References: <1597670664-14171-1-git-send-email-gbenson@redhat.com> <4b7a4f2e-9e77-495a-759b-187aebb342aa@palves.net> <20200825142146.GA14101@blade.nx> <20200827103901.GA9478@blade.nx> From: Luis Machado Message-ID: Date: Thu, 27 Aug 2020 08:25:32 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Aug 2020 11:25:39 -0000 On 8/27/20 8:20 AM, Pedro Alves wrote: > On 8/27/20 11:39 AM, Gary Benson wrote: >> Luis Machado wrote: >>> On 8/25/20 11:21 AM, Gary Benson via Gdb-patches wrote: >>>> Pedro Alves wrote: >>>>> On 8/17/20 2:24 PM, Gary Benson wrote: >>>>>> Pedro Alves wrote: >>>>>>> On 7/27/20 2:09 PM, Gary Benson via Gdb-patches wrote: >>>>>>>> + unsupported "compiler does not support -Wno-inaccessible-base" >>>>>>> >>>>>>> How about instead of bailing out, use "-Wno-inaccessible-base" >>>>>>> with GCC >= 10, and use "-w" with older GCCs? >>>>>> >>>>>> Sure. How about this? >>>>> >>>>> OK. >>>> >>>> Thanks, I pushed it. >>> >>> I get the following, under Ubuntu 18.04 (GCC 7.x) with this commit... >>> >>> 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 >>> >>> Is the test really supposed to run with older GCC's? >> >> Maybe not. Though, I don't know what version of GCC it ought to start >> working on, so it's hard to know what to do. I could leave the "-w" >> in for GCC < 10, and add an extra check to make it bail out for GCC >> <= your version, Luis? With a suitable comment to mention that that's >> not set in stone? > > > I'm seeing it fail with GCC 9 and clang 10 as well. > > Actually, the testcase can't be working _anywhere_. It's > testing a feature that is gone from GDB. > > The testcase come in with the HP merge: > > +Sun Jan 10 23:44:11 1999 David Taylor > + > + > + The following files are part of the HP merge; some had longer > + names at HP, but have been renamed to be no more than 14 > + characters in length. > > Looking at the tree back then, we had: > > /* Helper function used by value_struct_elt to recurse through baseclasses. > Look for a field NAME in ARG1. Adjust the address of ARG1 by OFFSET bytes, > and search in it assuming it has (class) type TYPE. > If found, return value, else return NULL. > > If LOOKING_FOR_BASECLASS, then instead of looking for struct fields, > look for a baseclass named NAME. */ > > static value_ptr > search_struct_field (name, arg1, offset, type, looking_for_baseclass) > char *name; > register value_ptr arg1; > int offset; > register struct type *type; > int looking_for_baseclass; > { > int found = 0; > char found_class[1024]; > value_ptr v; > struct type *vbase = NULL; > > found_class[0] = '\000'; > > v = search_struct_field_aux (name, arg1, offset, type, looking_for_baseclass, &found, found_class, &vbase); > if (found > 1) > warning ("%s ambiguous; using %s::%s. Use a cast to disambiguate.", > name, found_class, name); > > return v; > } > > But search_struct_field does not handle the ambiguous field > case nowadays. Somehow it got lost over the years. > That seems like a regression. I wrote up a patch that adds > it back (though different), but it exposed other latent > bugs... Sigh. I'll post it soon. Thanks. I've reached the same conclusion. This is an artifact of the HP merge back in the day. I see gdb.cp/ambiguous.exp (previously gdb.c++/ambiguous.exp) was not updated to remove these cases like gdb.cp/inherit.exp (previously gdb.c++/inherit.exp) was. See commit ebac27b4c38 for example: 2004-01-29 Michael Chastain * gdb.cp/inherit.exp: Rewrite. Use gdb_test_multiple and gdb for all tests. Remove old hp-ux and cygnus xfail cases.