This is the mail archive of the
mailing list for the GCC project.
GC/GTY and Coverity "resource leaks" (was Re: Daily Coverity analysis on gcc)
- From: David Malcolm <dmalcolm at redhat dot com>
- To: Sylvestre Ledru <sylvestre at debian dot org>, gcc at gcc dot gnu dot org
- Cc: Jonathan Wakely <jonathan dot wakely at gmail dot com>
- Date: Mon, 26 Jun 2017 15:14:12 -0400
- Subject: GC/GTY and Coverity "resource leaks" (was Re: Daily Coverity analysis on gcc)
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=dmalcolm at redhat dot com
- Dkim-filter: OpenDKIM Filter v2.11.0 mx1.redhat.com C982E315FBB
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com C982E315FBB
- References: <email@example.com>
On Mon, 2017-06-26 at 06:36 -0700, Sylvestre Ledru wrote:
> Over the last few weeks, working with Jonathan, I have been running
> daily analysis of Coverity (a proprietary static analyzer tool)
> It is running on a Debian amd64 with the options:
> --with-gnu-as --with-gnu-ld --disable-bootstrap
> --enable-languages=jit,c,c++,fortran,lto,objc --enable-host-shared
> Coverity finds about 4300 defects. The defect density is 1.67 for 2.5
> millions line of code.
> As a comparison, the llvm toolchain (llvm, clang, lldb, etc) has 3223
> defects (0.62 of defect density for 5.1M loc).
> Most of the defect are detected as resource leaks (1681 defects). I
> a quick look and many of them are actual issues (in many cases
> minor), I
> took the
> opportunity to fix some of them.
> To access to the list of results, you can apply
> https://scan.coverity.com/projects/gcc, please try to prove that you
> a gcc contributor.
The most recent one, and thus the first one I looked at (CID=1412982)
was a supposed "Resource Leak" in the get_cast_suggestion function I
introduced in r249461, where the local variable "trial" is supposedly
leaked (leading to 3 issues within Coverity overall, if I'm reading
things right, for the 3 ways in which a non-NULL value can be generated
and then fall out of scope).
But this is a tree, and will eventually be GC-ed.
So is there a way to teach Coverity about GTY and our garbage
collector? I'm wondering how many of the resource leak defects are
similar false positives.