From: Jason Merrill <jason@redhat.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: "Joseph S. Myers" <joseph@codesourcery.com>,
"Carlos O'Donell" <carlos@redhat.com>,
Siddhesh Poyarekar <siddhesh@redhat.com>,
gcc-patches@gcc.gnu.org, libc-alpha@sourceware.org
Subject: Re: [RFC PATCH] -Wmemset-transposed-args (PR middle-end/61294)
Date: Tue, 08 Jul 2014 22:33:00 -0000 [thread overview]
Message-ID: <53BC71CE.6000504@redhat.com> (raw)
In-Reply-To: <20140708203151.GP31640@tucnak.redhat.com>
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
next prev parent reply other threads:[~2014-07-08 22:33 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-08 12:50 Jakub Jelinek
2014-07-08 19:25 ` Jason Merrill
2014-07-08 19:38 ` Carlos O'Donell
2014-07-08 20:32 ` Jakub Jelinek
2014-07-08 22:33 ` Jason Merrill [this message]
2014-07-09 10:26 ` Richard Biener
2014-07-09 10:33 ` Jakub Jelinek
2014-07-09 10:51 ` Richard Biener
2014-07-09 11:09 ` Jakub Jelinek
2014-07-08 19:34 ` Carlos O'Donell
2014-07-09 14:40 Manuel López-Ibáñez
2014-07-09 21:28 ` Jason Merrill
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53BC71CE.6000504@redhat.com \
--to=jason@redhat.com \
--cc=carlos@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
--cc=joseph@codesourcery.com \
--cc=libc-alpha@sourceware.org \
--cc=siddhesh@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).