From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13735 invoked by alias); 25 Oct 2013 06:58:19 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 13323 invoked by uid 48); 25 Oct 2013 06:58:15 -0000 From: "laurent.alfonsi at st dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug gcov-profile/58602] .gcno files not truncated at gcov_close Date: Fri, 25 Oct 2013 06:58:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: gcov-profile X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: laurent.alfonsi at st dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-10/txt/msg01805.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58602 --- Comment #4 from Laurent Aflonsi --- 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 PR gcov-profile/58602 * gcc/gcov-io.c (gcov_open): Open with truncation when mode<0 Regards, Laurent