Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: completion on brace + 4 characters doesn't work

On 2011-04-29 10:44:44 +0200, Vincent Lefevre wrote:
> On 2011-04-28 20:56:57 -0700, Bart Schaefer wrote:
> > Out of curiosity, does the behavior change if you crank down the
> > degree of optimization (or up the of debugging) in the compiler flags
> > when building?
> For the test with valgrind, zsh was compiled with no optimizations,
> because I configured it with the option --enable-zsh-debug.
> Now, the optimization level doesn't affect the use of GCC builtins
> (there's one for strcpy).

In fact, the behavior comes from glibc on x86_64. It can be
reproduced with:

#include <stdio.h>
#include <string.h>

int main (void)
  static char s[] = "{abcd";
  volatile int len = 1;

  printf ("s = %s\n", s);
  strcpy (s, s + len);
  printf ("s = %s\n", s);
  return 0;

and gcc -fno-builtin (the strcpy builtin was not used anyway).

According to gdb, the source in eglibc-2.11.2 is
sysdeps/x86_64/multiarch/strcpy.S (strcpy with SSSE3). It can load
16 bytes at a time, and it uses special code on these 16 bytes (I'm
not sure, but it seems to have code for each length).

Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Arénaire project (LIP, ENS-Lyon)

Messages sorted by: Reverse Date, Date, Thread, Author