public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/62156] New: memcmp doesn't see through memcpy at compile-time
@ 2014-08-15 11:36 glisse at gcc dot gnu.org
  2014-08-18 14:06 ` [Bug tree-optimization/62156] " rguenth at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: glisse at gcc dot gnu.org @ 2014-08-15 11:36 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 62156
           Summary: memcmp doesn't see through memcpy at compile-time
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: glisse at gcc dot gnu.org

int f(){
  const char*a="abcdefghijkl";
  const char*b="acbdefghijkl";
  char*c=(char*)__builtin_malloc(42);
  __builtin_memcpy(c,b,13);
  return __builtin_memcmp(a,c,5);
}

We have no problem computing strlen(c) or memcmp(a,b,5) at compile-time, but we
don't manage to fold this. This type of code is what we get with std::string
when we inline everything.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-08-19 11:19 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-15 11:36 [Bug tree-optimization/62156] New: memcmp doesn't see through memcpy at compile-time glisse at gcc dot gnu.org
2014-08-18 14:06 ` [Bug tree-optimization/62156] " rguenth at gcc dot gnu.org
2014-08-18 14:47 ` glisse at gcc dot gnu.org
2014-08-18 15:19 ` glisse at gcc dot gnu.org
2014-08-19  8:02 ` rguenther at suse dot de
2014-08-19 11:15 ` glisse at gcc dot gnu.org
2014-08-19 11:19 ` rguenther at suse dot de

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).