diff mbox series

Fix profile name files without -fprofile-dir.

Message ID 3dac6764-6435-8237-6028-505f2ecafebd@suse.cz
State New
Headers show
Series Fix profile name files without -fprofile-dir. | expand

Commit Message

Martin Liška Dec. 4, 2019, 10:48 a.m. UTC
Hello.

As mentioned in here https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91971#c7,
we should not mangle profile data and note files unless -fprofile-dir is
used (and an absolute path is used).

Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
I'll install the patch if there are no objections.

Thanks,
Martin

gcc/ChangeLog:

2019-12-04  Martin Liska  <mliska@suse.cz>

	PR gcov-profile/91971
	* coverage.c (coverage_init): Mangle full path
	only when -fprofile-dir is used.
---
  gcc/coverage.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/gcc/coverage.c b/gcc/coverage.c
index b8b20ddc8e3..2cdbb0172c9 100644
--- a/gcc/coverage.c
+++ b/gcc/coverage.c
@@ -1228,7 +1228,7 @@  coverage_init (const char *filename)
       else
 	profile_data_prefix = getpwd ();
     }
-  else
+  else if (profile_data_prefix != NULL)
     {
       /* when filename is a absolute path, we also need to mangle the full
       path of filename to prevent the profiling data being stored into a