This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix PR c++/92024
- From: Bernd Edlinger <bernd dot edlinger at hotmail dot de>
- To: Jason Merrill <jason at redhat dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, Nathan Sidwell <nathan at acm dot org>, Sandra Loosemore <sandra at codesourcery dot com>
- Date: Fri, 18 Oct 2019 13:19:23 +0000
- Subject: Re: [PATCH] Fix PR c++/92024
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=e2VPCAW+Bl/DJ4Jo7wcqovXYJkOyhm6agStyfND+wrI=; b=cUxfbWziW24yhJniPHLbBJ83w0OVDT3bSI0UrYHm2wwYzcor8gPoP/48IpvNMAw9JHziLHwdj7JYDM1ClqyxQoOcjd7/p9NxY7vikkAnGOTDb4+AOMSEuesi7a02iLWwwJzKwpyDcTeOcsVB/fnuGpRTNKBat8MOZUdwVdSnHBh41vg95XH0JQuYEJ7WjHSNSqJ8PZaqeJFP39mf9Gve/v3fz0APgTt7ZhmnGe7Qc0I6hItucDHRuRz2Bz4GwzRFFkLghqybgCwNo2jiIDJMnfcpEBhOTnQithcwRTWNFyOE5iTJKGNoUj381vCqSs8NLyx8fXwRhu/D99LyhdXNVw==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Hr+2xolFn4XJdLMQbXybI/6iebopsGQXtXHFqUEsni9DSelHmMb1BM1I2R8s+7N1CvVN3hKIj2UNzBBtSgX9DMRDasWC5zlNZrmtSWLMoncmxOBeKvJvOTNdN9ahAs0yHFE9AAQx4nq6wA+Und8wzXj40INw8rFyPlVuuor7pgyU9LLa7KZdB9SrcpJk2VPH8s31pqE7pkMZJFZoqi9CbCws++Rbwn21Vl7LFmCx51hFgXvWXAXF6e0p6jixPOqirClakmQ+iYAz0uc6mf/LjaxE+8RiA3qc7o5w0g6ViTFQ+nonNeK8vIrWw3f1q0lL0Trg7gZqcfU1/xNhpYlM5w==
- References: <VI1PR03MB4528718F49EF7008FAA741BEE4940@VI1PR03MB4528.eurprd03.prod.outlook.com> <ca2b1e61-46a4-919a-baa7-c29bb51f84f4@redhat.com> <VI1PR03MB452873B8B33E1908B7AB438BE4940@VI1PR03MB4528.eurprd03.prod.outlook.com> <b5bb6733-c74a-4291-6ed2-0bd5c72ee842@redhat.com> <VI1PR03MB4528C6A2DDC42F42CD42E748E4960@VI1PR03MB4528.eurprd03.prod.outlook.com>
Ping...
for the c++ FE and testsuite changes in the updated patch
here: https://gcc.gnu.org/ml/gcc-patches/2019-10/msg00916.html
Thanks
Bernd.
On 10/12/19 8:10 PM, Bernd Edlinger wrote:
> On 10/11/19 6:31 PM, Jason Merrill wrote:
>> On 10/10/19 2:06 PM, Bernd Edlinger wrote:
>>> On 10/10/19 7:49 PM, Jason Merrill wrote:
>>>
>>> if -Wshadow=compatible-local is used, the can_convert function crashes
>>> in instantiate_class_template_1.
>>
>> Right, checking can_convert is problematic here, as it can cause template instantiations that change the semantics of the program. Or, in this case, crash.
>>
>
> So I try to make C++ behave more consistently with the code in c-decl.c,
> thus dependent on warn_shadow but not on warn_shadow_local and/or
> warn_shadow_compatible_local:
>
> if (warn_shadow)
> warning_code = OPT_Wshadow;
> else if (comptypes (TREE_TYPE (old_decl), TREE_TYPE (new_decl)))
> warning_code = OPT_Wshadow_compatible_local;
> else
> warning_code = OPT_Wshadow_local;
> warned = warning_at (DECL_SOURCE_LOCATION (new_decl), warning_code,
> "declaration of %qD shadows a parameter",
> new_decl);
>
> I cannot remove the if (warn_shadow) since this breaks gcc.dg/pr48062.c
> which uses:
>
> #pragma GCC diagnostic ignored "-Wshadow"
>
> to disable a -Wshadow=compatible-local warning, but while -Wno-shadow on the
> command line disables also dependent warnings the pragma does not (always) do that.
>
> So instead I'd like to adjust the doc of -Wshadow to reflect the implementation
> and remove the if(warn_shadow_local) to have C and C++ behave identical and
> hopefully now in sync with the doc.
>
>
> Bootstrapped and reg-tested on x86_64-pc-linux-gnu.
> Is it OK for trunk?
>
>
> Thanks
> Bernd.
>