This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [RFC PATCH] -Wmemset-transposed-args (PR middle-end/61294)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Jason Merrill <Jason at redhat dot com>
- Cc: "Joseph S. Myers" <joseph at codesourcery dot com>, "Carlos O'Donell" <carlos at redhat dot com>, Siddhesh Poyarekar <siddhesh at redhat dot com>, gcc-patches at gcc dot gnu dot org, libc-alpha at sourceware dot org
- Date: Tue, 8 Jul 2014 22:31:51 +0200
- Subject: Re: [RFC PATCH] -Wmemset-transposed-args (PR middle-end/61294)
- Authentication-results: sourceware.org; auth=none
- References: <20140708125017 dot GN31640 at tucnak dot redhat dot com> <p35hitgbscyj3xuum5kryq1g dot 1404847489032 at email dot android dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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