From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1377 invoked by alias); 9 Oct 2012 09:21:01 -0000 Received: (qmail 1327 invoked by uid 22791); 9 Oct 2012 09:20:52 -0000 X-SWARE-Spam-Status: No, hits=-5.0 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-ob0-f175.google.com (HELO mail-ob0-f175.google.com) (209.85.214.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 09 Oct 2012 09:20:47 +0000 Received: by mail-ob0-f175.google.com with SMTP id eq6so4979417obc.20 for ; Tue, 09 Oct 2012 02:20:46 -0700 (PDT) MIME-Version: 1.0 Received: by 10.60.28.167 with SMTP id c7mr11326736oeh.44.1349774446362; Tue, 09 Oct 2012 02:20:46 -0700 (PDT) Received: by 10.76.95.202 with HTTP; Tue, 9 Oct 2012 02:20:46 -0700 (PDT) In-Reply-To: <50733211.5030602@net-b.de> References: <50733211.5030602@net-b.de> Date: Tue, 09 Oct 2012 09:21:00 -0000 Message-ID: Subject: Re: Small cleanup/memory leak plugs for lto From: Richard Guenther To: Tobias Burnus Cc: gcc-patches Content-Type: text/plain; charset=ISO-8859-1 X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2012-10/txt/msg00848.txt.bz2 On Mon, Oct 8, 2012 at 10:05 PM, Tobias Burnus 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