Index: gcc/libgcov.c =================================================================== --- gcc/libgcov.c (revision 150364) +++ gcc/libgcov.c (working copy) @@ -166,6 +166,7 @@ int gcov_prefix_strip = 0; size_t prefix_length; char *gi_filename, *gi_filename_up; + mode_t saved_umask; memset (&all, 0, sizeof (all)); /* Find the totals for this execution. */ @@ -219,6 +220,10 @@ memcpy (gi_filename, gcov_prefix, prefix_length); gi_filename_up = gi_filename + prefix_length; + /* Temporarily change the umask so that writing to the data file + doesn't depend on the umask of the application being profiled. */ + saved_umask = umask (S_IWGRP | S_IWOTH); + /* Now merge each file. */ for (gi_ptr = gcov_list; gi_ptr; gi_ptr = gi_ptr->next) { @@ -525,6 +530,9 @@ "profiling:%s:Error writing\n", gi_filename); } + + /* Restore the umask. */ + umask (saved_umask); } /* Add a new object file onto the bb chain. Invoked automatically