This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Small cleanup/memory leak plugs for lto
- From: Richard Guenther <richard dot guenther at gmail dot com>
- To: Tobias Burnus <burnus at net-b dot de>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 9 Oct 2012 11:20:46 +0200
- Subject: Re: Small cleanup/memory leak plugs for lto
- References: <50733211.5030602@net-b.de>
On Mon, Oct 8, 2012 at 10:05 PM, Tobias Burnus <burnus@net-b.de> wrote:
> Some more issues found by Coverity scanner.
>
> lto-cgraph.c: The code seems to be unused, besides, it's a zero-trip loop as
> parm_num is set to 0 and then checked non nonzeroness.
>
> lto-opts: The check whether first_p is non NULL is always false: All calls
> have a variable ref as argument - and first_p is unconditionally
> dereferenced.
>
> lto_obj_file_open: One could check additionally check "lo" is NULL, but that
> has then to be directly after the XCNEW as already lto_file_init
> dereferences "lo".
static void
append_to_collect_gcc_options (struct obstack *ob,
bool *first_p, const char *opt)
{
const char *p, *q = opt;
- if (!first_p)
- obstack_grow (ob, " ", 1);
bogus change. It should be
if (!*first_p)
obstack_grow (ob, " ", 1);
The rest looks ok. Please re-test with the above change.
Thanks,
Richard.
> Build and regtested on x86-64-gnu-linux
>
> Tobias