This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Gcc builtin review: strfry, basename, strncpy, memfrob
- From: OndÅej BÃlka <neleai at seznam dot cz>
- To: libc-alpha at sourceware dot org
- Cc: Andrew Pinski <pinskia at gmail dot com>
- Date: Mon, 25 May 2015 21:28:40 +0200
- Subject: Re: Gcc builtin review: strfry, basename, strncpy, memfrob
- Authentication-results: sourceware.org; auth=none
- References: <20150525101505 dot GA11233 at domone> <20150525114545 dot GC11233 at domone>
And I was most disapointed on lack of gcc support with these functions.
Memfrob is essential security feature but gcc doesn't optimize it at all.
Sadly in strfry gcc could use opportunity of fixing glibc bug but it
doesn't do it.
While gcc optimizes strncpy a bit it doesn't do that enough. It should
expand to sequence of stores for at least size 1000. A strncpy is best
way to copy strings. And what more. You could also use strncpy as memset
by passing "" as second argument.
Also basename should be always inlined as it almost always lies in hot
path followed by opening file.