public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Small cleanup/memory leak plugs for lto
@ 2012-10-08 20:05 Tobias Burnus
  2012-10-09  9:21 ` Richard Guenther
  0 siblings, 1 reply; 2+ messages in thread
From: Tobias Burnus @ 2012-10-08 20:05 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 548 bytes --]

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".

Build and regtested on x86-64-gnu-linux

Tobias

[-- Attachment #2: patch.diff --]
[-- Type: application/unknown, Size: 5854 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Small cleanup/memory leak plugs for lto
  2012-10-08 20:05 Small cleanup/memory leak plugs for lto Tobias Burnus
@ 2012-10-09  9:21 ` Richard Guenther
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Guenther @ 2012-10-09  9:21 UTC (permalink / raw)
  To: Tobias Burnus; +Cc: gcc-patches

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-10-09  9:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-08 20:05 Small cleanup/memory leak plugs for lto Tobias Burnus
2012-10-09  9:21 ` Richard Guenther

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).