From: Bernd Schmidt <bschmidt@redhat.com>
To: Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>,
gcc Patches <gcc-patches@gcc.gnu.org>,
Richard Biener <rguenther@suse.de>
Subject: Re: Fold strstr (s, t) eq/ne s to strcmp (s, t) eq/ne 0 if strlen (t) is known
Date: Mon, 05 Dec 2016 18:08:00 -0000 [thread overview]
Message-ID: <fc15ecd9-0045-bc6b-f84f-f3b50b970885@redhat.com> (raw)
In-Reply-To: <CAAgBjMn2AWAP9tu+qknHnPEhOAh7Au7Ke4YFGcJeSkfJ=Ts=Zg@mail.gmail.com>
On 12/05/2016 07:02 PM, Prathamesh Kulkarni wrote:
> This patch folds strstr (s, t) eq/ne s to strcmp (s, t) eq/ne 0 if
> strlen (t) is known.
That's not the same thing, is it?
s = "hello world", t = "hello":
strstr (s, t) == s, but not strcmp (s, t) == 0.
I think you'd want memcmp (s, t, strlen (t)) == 0.
Bernd
next prev parent reply other threads:[~2016-12-05 18:08 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-05 18:02 Prathamesh Kulkarni
2016-12-05 18:08 ` Bernd Schmidt [this message]
2016-12-05 18:10 ` Prathamesh Kulkarni
2016-12-05 18:14 ` Prathamesh Kulkarni
2016-12-05 18:17 ` Jakub Jelinek
2016-12-07 11:33 ` Prathamesh Kulkarni
2016-12-07 12:06 ` Jakub Jelinek
2016-12-09 12:06 ` Prathamesh Kulkarni
2016-12-09 12:29 ` Jakub Jelinek
2016-12-13 9:38 ` Prathamesh Kulkarni
2016-12-13 9:57 ` Jakub Jelinek
2016-12-13 12:11 ` Prathamesh Kulkarni
2016-12-13 12:24 ` Jakub Jelinek
2016-12-14 8:03 ` Prathamesh Kulkarni
2016-12-14 8:07 ` Jakub Jelinek
2017-01-23 11:51 ` Martin Liška
2017-01-23 14:14 ` [PATCH] Fix strstr folding (PR tree-optimization/79196) Martin Liška
2017-01-23 14:51 ` Jakub Jelinek
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=fc15ecd9-0045-bc6b-f84f-f3b50b970885@redhat.com \
--to=bschmidt@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=prathamesh.kulkarni@linaro.org \
--cc=rguenther@suse.de \
/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).