This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Do not create invalid pointers in C code of string functions.

On Fri, 2015-07-03 at 21:48 +0200, OndÅej BÃlka wrote:
> On Fri, Jul 03, 2015 at 08:54:33PM +0200, Torvald Riegel wrote:
> > Some of the x86 string functions create pointers based on input strings
> > that may be outside of the input strings.  When this happens in C code,
> > the compiler can potentially detect this, leading to warnings in
> > application code when those string functions are inlined.  Perform those
> > operations in the assembly code instead of the C code to fix this.
> > 
> > The respective operations all substract 1; this patch may prevent the
> > compiler from doing that at compile time if the input strings have known
> > addresses.  I haven't measured performance, but I'd guess that it's in
> > the noise except perhaps for microbenchmarks with tiny or empty strings.
> > 
> > If someone wants to propose a better patch, please do so.  But do it
> > quick because this issue currently prevents x86 builds with a recent
> > GCC :)
> >
> While patch itself is correct it would be better to just delete these.
> Performance-wise these are lot slower than libcall and I am surprised
> that anybody used these. 

I have just committed this patch to fix the correctness/build problems.
I am not sufficiently familiar with the performance of the string
functions to address your other suggestion.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]