https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84487
--- Comment #3 from Janne Blomqvist <jb at gcc dot gnu.org> ---
I suspect it's working as intended. From the patch there is this comment which
explains in equivalent C code the code which is generated:
/* The string copy algorithm below generates code like
- if (dlen > 0) {
- memmove (dest, src, min(dlen, slen));
- if (slen < dlen)
- memset(&dest[slen], ' ', dlen - slen);
- }
+ if (destlen > 0)
+ {
+ if (srclen < destlen)
+ {
+ memmove (dest, src, srclen);
+ // Pad with spaces.
+ memset (&dest[srclen], ' ', destlen - srclen);
+ }
+ else
+ {
+ // Truncate if too long.
+ memmove (dest, src, destlen);
+ }
+ }
*/
So with the new (or old, if you prefer, since this code was previously there
too, IIRC I changed it sometime in vicinity of January 2017) code, if either
srclen or destlen is a compile time constant, the compiler can inline expand
one of the memmove calls.
Does r257233 cause any change in performance for spec?