From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22621 invoked by alias); 8 Jul 2014 20:32:06 -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 22597 invoked by uid 89); 8 Jul 2014 20:32:04 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.8 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 20:32:03 +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 s68KVw51029963 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 8 Jul 2014 16:31:59 -0400 Received: from tucnak.zalov.cz (ovpn-116-32.ams2.redhat.com [10.36.116.32]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s68KVu5k027673 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 8 Jul 2014 16:31:57 -0400 Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.14.8/8.14.7) with ESMTP id s68KVsxx020550; Tue, 8 Jul 2014 22:31:55 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.14.8/8.14.8/Submit) id s68KVp1d020548; Tue, 8 Jul 2014 22:31:51 +0200 Date: Tue, 08 Jul 2014 20:32:00 -0000 From: Jakub Jelinek To: Jason Merrill 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) Message-ID: <20140708203151.GP31640@tucnak.redhat.com> Reply-To: Jakub Jelinek References: <20140708125017.GN31640@tucnak.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes X-SW-Source: 2014-07/txt/msg00581.txt.bz2 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'. In any case, it seems both the C and C++ FEs fold the arguments too early, already during the parsing of the argument list. In the C FE, there is original_code in the c_expr struct, so perhaps I could somehow propagate it to the caller for the first few arguments and test that original_code is INTEGER_CST in addition to integer_zerop to check for 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? Any suggestions how to find out if it was literal 0 or something that folded to 0 in the C++ FE? Jakub