From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7986 invoked by alias); 8 Jul 2014 22:33:56 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 7968 invoked by uid 89); 8 Jul 2014 22:33:56 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.2 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_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, 08 Jul 2014 22:33:54 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s68MXpc8007902 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 8 Jul 2014 18:33:52 -0400 Received: from [10.3.113.31] (ovpn-113-31.phx2.redhat.com [10.3.113.31]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s68MXoTt017216; Tue, 8 Jul 2014 18:33:50 -0400 Message-ID: <53BC71CE.6000504@redhat.com> Date: Tue, 08 Jul 2014 22:33:00 -0000 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: Jakub Jelinek CC: "Joseph S. Myers" , "Carlos O'Donell" , Siddhesh Poyarekar , gcc-patches@gcc.gnu.org, libc-alpha@sourceware.org Subject: Re: [RFC PATCH] -Wmemset-transposed-args (PR middle-end/61294) References: <20140708125017.GN31640@tucnak.redhat.com> <20140708203151.GP31640@tucnak.redhat.com> In-Reply-To: <20140708203151.GP31640@tucnak.redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2014-07/txt/msg00589.txt.bz2 On 07/08/2014 12:38 PM, Carlos O'Donell wrote: > What rationale would you give for not warning on 1-1? Because it's not likely to be a case of argument transposition; it's more likely to be an expression that just happens to evaluate to 0, which is fine as a length argument to memset. On 07/08/2014 01:31 PM, Jakub Jelinek wrote: > On Tue, Jul 08, 2014 at 03:24:52PM -0400, Jason Merrill wrote: >> I don't think we want to warn about e.g. 1-1, only about literal 0. > > Well, at least literal 0 and '\0'. Right, I consider '\0' to be a literal 0. > But in the C++ FE there isn't something like that. Do you think we > shouldn't warn even if e.g. the last argument is a template parameter > that turns out to be 0, so warn only during parsing and check for literal > 0 and not warn again during instantiation? Yes, that's what I think. > Any suggestions how to find out > if it was literal 0 or something that folded to 0 in the C++ FE? I suppose we could use an INTEGER_CST distinct from the one in TYPE_CACHED_VALUES for raw 0, with a TREE_LANG_FLAG set. Jason