public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenther at suse dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/63989] tree-ssa-strlen.c doesn't handle constant pointer plus and array refs if constant offset is smaller than known constant string length
Date: Thu, 20 Nov 2014 11:20:00 -0000	[thread overview]
Message-ID: <bug-63989-4-Tr1hdC8rY2@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-63989-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63989

--- Comment #2 from rguenther at suse dot de <rguenther at suse dot de> ---
On Thu, 20 Nov 2014, jakub at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63989
> 
> Jakub Jelinek <jakub at gcc dot gnu.org> changed:
> 
>            What    |Removed                     |Added
> ----------------------------------------------------------------------------
>              Status|UNCONFIRMED                 |NEW
>    Last reconfirmed|                            |2014-11-20
>      Ever confirmed|0                           |1
> 
> --- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
> So, we are talking here about e.g.
> 
> int
> f1 (char *p)
> {
>   __builtin_strcpy (p, "foobar");
>   return __builtin_strlen (p + 2);
> }
> 
> int
> f2 (char *p)
> {
>   __builtin_strcpy (p, "foobar");
>   p[2] = '\0';
>   return __builtin_strlen (p);
> }
> 
> int
> f3 (char *p)
> {
>   __builtin_strcpy (p, "foobar");
>   p[2] = '\0';
>   return __builtin_strlen (p + 3);
> }
> 
> int
> f4 (char *p)
> {
>   __builtin_strcpy (p, "foobar");
>   p[2] = 'z';
>   return __builtin_strlen (p);
> }
> 
> and then also determining using get_string_length (if constant) whether a
> character pointer dereference is known to be zero or known to be non-zero.

Well, we are mainly talking about the case where I had to XFAIL
gcc.dg/strlenopt-8.c for us now inline-expanding a two-character
memcpy to a short store.


  parent reply	other threads:[~2014-11-20 11:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-20  9:31 [Bug tree-optimization/63989] New: " jakub at gcc dot gnu.org
2014-11-20  9:44 ` [Bug tree-optimization/63989] " jakub at gcc dot gnu.org
2014-11-20 11:20 ` rguenther at suse dot de [this message]
2014-11-21  9:38 ` jakub at gcc dot gnu.org
2014-12-08 17:25 ` jakub at gcc dot gnu.org
2015-01-08 21:31 ` jakub at gcc dot gnu.org
2015-04-22 12:01 ` jakub at gcc dot gnu.org
2015-07-16  9:18 ` rguenth at gcc dot gnu.org
2022-01-09  0:45 ` pinskia at gcc dot gnu.org

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=bug-63989-4-Tr1hdC8rY2@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).