[Bug rtl-optimization/31849] [4.2/4.3 Regression] Code size regression caused by fix to PR 31360

rearnsha at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Mon May 7 09:43:00 GMT 2007



------- Comment #7 from rearnsha at gcc dot gnu dot org  2007-05-07 10:43 -------
Here's another example of code that is now significantly worse (~20% larger). 
Rather than incrementing the base pointers on each iteration of the loop, we
now maintain both base pointers and and offset.  This costs two extra registers
for no benefit at all.

char * strncat(char *dest, const char *src, unsigned count)
{
        char *tmp = dest;

        if (count) {
                while (*dest)
                        dest++;
                while ((*dest++ = *src++)) {
                        if (--count == 0) {
                                *dest = '\0';
                                break;
                        }
                }
        }

        return tmp;
}


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31849



More information about the Gcc-bugs mailing list