This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Append PWD to path when using -fprofile-generate=/some/path.
- From: Martin Sebor <msebor at gmail dot com>
- To: Martin Liška <mliska at suse dot cz>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: Richard Biener <richard dot guenther at gmail dot com>, Jan Hubicka <hubicka at ucw dot cz>
- Date: Wed, 20 Dec 2017 10:35:44 -0700
- Subject: Re: [PATCH] Append PWD to path when using -fprofile-generate=/some/path.
- Authentication-results: sourceware.org; auth=none
- References: <f61115af-55e1-8d59-545f-295f7e5b53cb@suse.cz> <41f0b7e4-1a6b-3f5e-1e3a-750502e73043@suse.cz>
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