[Bug 1353142] Re: subversion tests fail on ppc64el when built with -O3

Alan Modra amodra.tools at gmail.com
Fri Aug 8 13:20:31 UTC 2014


Compiling libsvn_delta/text_delta.c with -O2 -ftree-loop-vectorize
-fvect-cost-model=dynamic also causes failure (ie. those two options are
the specific ones added by -O3 that cause failure).  The problem is this
code:

/* Copy LEN bytes from SOURCE to TARGET.  Unlike memmove() or memcpy(),
 * create repeating patterns if the source and target ranges overlap.
 * Return a pointer to the first byte after the copied target range.  */
static APR_INLINE char *
patterning_copy(char *target, const char *source, apr_size_t len)
{
  const char *end = source + len;

  /* On many machines, we can do "chunky" copies. */

#if SVN_UNALIGNED_ACCESS_IS_OK

  if (end + sizeof(apr_uint32_t) <= target)
    {
      /* Source and target are at least 4 bytes apart, so we can copy in
       * 4-byte chunks.  */
      for (; source + sizeof(apr_uint32_t) <= end;
           source += sizeof(apr_uint32_t),
           target += sizeof(apr_uint32_t))
      *(apr_uint32_t *)(target) = *(apr_uint32_t *)(source);
    }

#endif

  /* fall through to byte-wise copy (either for the below-chunk-size tail
   * or the whole copy) */
  for (; source != end; source++)
    *(target++) = *source;

  return target;
}

Specifically the code inside #if SVN_UNALIGNED_ACCESS_IS_OK.  That loop
can't be done in any chunks bigger than the difference between "target"
and "end", but it seems the loop vectorizer is not careful enough to
handle overlapping target and source in this case.

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to gcc-4.9 in Ubuntu.
https://bugs.launchpad.net/bugs/1353142

Title:
  subversion tests fail on ppc64el when built with -O3

Status in “gcc-4.9” package in Ubuntu:
  New
Status in “subversion” package in Ubuntu:
  New

Bug description:
  subversion tests fail on ppc64el when built with -O3, seen in

  https://launchpad.net/ubuntu/+source/subversion/1.8.9-2ubuntu1

  building with -O2 lets the tests succeed
  https://launchpad.net/ubuntu/+source/subversion/1.8.9-2ubuntu2

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gcc-4.9/+bug/1353142/+subscriptions



More information about the foundations-bugs mailing list