On 10/27/2017 07:17 AM, Martin Liška wrote:
Hello.
It's improvement that I consider still useful even though we're not
going to use
it for profiled bootstrap.
Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
For what it's worth, although it looks correct as is, I think
the code in the patch would be clearer and less prone to off
by-1 errors, while at the same time equally as efficient, if
it were written in terms of strcpy and strcat:
char *b = XNEWVEC (char,
2 + strlen (pwd)
+ strlen (profile_data_prefix));
strcpy (b, profile_data_prefix);
strcat (b, "/");
strcat (b, pwd);
GCC has all the smarts to turn this code into the elaborated
form using memcpy. Plus, it's getting better at checking
string functions for invalid accesses, but it's not quite
as good at checking raw memory functions, or at checking
combinations of those and direct accesses to array elements.
We might as well eat our own dog food and put all this
machinery to good use within GCC itself.
Martin