From patchwork Mon Oct 18 05:40:50 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Basile Starynkevitch X-Patchwork-Id: 68122 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 02640B70F7 for ; Mon, 18 Oct 2010 16:42:10 +1100 (EST) Received: (qmail 27097 invoked by alias); 18 Oct 2010 05:42:07 -0000 Received: (qmail 27083 invoked by uid 22791); 18 Oct 2010 05:42:06 -0000 X-SWARE-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from smtp-100-sunday.noc.nerim.net (HELO mallaury.nerim.net) (62.4.17.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 18 Oct 2010 05:42:01 +0000 Received: from hector.lesours (ours.starynkevitch.net [213.41.244.95]) by mallaury.nerim.net (Postfix) with ESMTPS id B9708A1053; Mon, 18 Oct 2010 07:41:58 +0200 (CEST) Received: from glinka.lesours ([192.168.0.1] helo=glinka) by hector.lesours with smtp (Exim 4.72) (envelope-from ) id 1P7iTu-000837-AM; Mon, 18 Oct 2010 07:41:58 +0200 Date: Mon, 18 Oct 2010 07:40:50 +0200 From: Basile Starynkevitch To: Laurynas Biveinis Cc: Diego Novillo , gcc-patches@gcc.gnu.org, jeremie.salvucci@free.fr Subject: Re: Ping! gengtype plugin improvement last2round - patch 1 [declprog] Message-Id: <20101018074050.aa438178.basile@starynkevitch.net> In-Reply-To: References: <20100923195519.8eeaba90.basile@starynkevitch.net> <20100923180841.GH1269@tyan-ft48-01.lab.bos.redhat.com> <20100924065252.99509bd6.basile@starynkevitch.net> <20100924193729.391a15f1.basile@starynkevitch.net> <20100924202518.42420b16.basile@starynkevitch.net> <20101004214723.5c5b72a2.basile@starynkevitch.net> <4CB70398.1020509@google.com> <20101014135855.GA5940@hector.lesours> <20101017102619.b33e5b70.basile@starynkevitch.net> Mime-Version: 1.0 X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org On Mon, 18 Oct 2010 06:47:30 +0300 Laurynas Biveinis wrote: > 2010/10/17 Basile Starynkevitch : > > There remains a bug in the code,  plugin_files was not allocated. > > > 2010-10-17  Basile Starynkevitch   > >        * gengtype.c (parse_program_options): Allocate plugin_files. > > The patch is OK - and it is obvious, IMHO. > > However, while reviewing this I found the following in main: > > if (nb_plugin_files <= 0 || !plugin_files) > fatal ("No plugin files given in plugin mode for %s", > plugin_output_filename); > > nb_plugin_files is of size_t, which is unsigned. Please replace with ==. I just committed the following patch to trunk: With the gcc/ChangeLog entry: 2010-10-18 Basile Starynkevitch * gengtype.c (parse_program_options): Added allocation of plugin_files, and corrected test on nb_plugin_files. Committed revision 165608. Index: gcc/gengtype.c =================================================================== --- gcc/gengtype.c (revision 165607) +++ gcc/gengtype.c (working copy) @@ -4395,6 +4395,7 @@ parse_program_options (int argc, char **argv) if (optind >= argc) fatal ("no source files given in plugin mode"); nb_plugin_files = argc - optind; + plugin_files = XNEWVEC (char*, nb_plugin_files); for (i = 0; i < (int) nb_plugin_files; i++) { char *name = argv[i + optind]; @@ -4488,7 +4489,7 @@ main (int argc, char **argv) fatal ("No read state given in plugin mode for %s", plugin_output_filename); - if (nb_plugin_files <= 0 || !plugin_files) + if (nb_plugin_files == 0 || !plugin_files) fatal ("No plugin files given in plugin mode for %s", plugin_output_filename);