This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Small cleanup/memory leak plugs for lto


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]