This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/79310] -Wnonnull false positive on strlen after strstr
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 01 Feb 2017 08:58:39 +0000
- Subject: [Bug middle-end/79310] -Wnonnull false positive on strlen after strstr
- Auto-submitted: auto-generated
- References: <bug-79310-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79310
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2017-02-01
Ever confirmed|0 |1
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
match.pd is your friend.
(simplify
(ne (BUILT_IN_STRSTR @0 @1) integer_zerop)
(with
{
unsigned HOST_WIDE_INT string_length;
const char *p = c_getstr (@1, &string_length);
}
(if (p && string_length == 0)
{ constant_boolean_node (type, true); })))
etc.