http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58602
--- Comment #4 from Laurent Aflonsi <laurent.alfonsi at st dot com> --- When the .gcno graph file is opened for generating the coverage graph information, the mode used is w+ as this code is shared with updating tools such as libgcov. Thus, when GCC outputs .gcno files, it may leave garbage at the end of the file if the file already exists when opening it. This has been trackeddown from a kernel issue on lcov: http://sourceforge.net/p/ltp/mailman/message/31141937/ This patch fixes the function gcov_open() such that the .gcno file is opened with truncation when gcc asks for creating a new file (mode<0). which I also proposed on the mailing list some time ago, but i got no feedbacks. http://gcc.gnu.org/ml/gcc-patches/2013-10/msg00254.html Here is a Changelog: 2013-10-03 Laurent Alfonsi <laurent.alfo...@st.com> PR gcov-profile/58602 * gcc/gcov-io.c (gcov_open): Open with truncation when mode<0 Regards, Laurent