From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 35399 invoked by alias); 11 May 2016 20:51:14 -0000 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 Received: (qmail 35375 invoked by uid 89); 11 May 2016 20:51:13 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.3 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 11 May 2016 20:51:01 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C04F063306 for ; Wed, 11 May 2016 20:51:00 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-116-17.ams2.redhat.com [10.36.116.17]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u4BKowj0021919 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 11 May 2016 16:50:59 -0400 Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id u4BKovKZ021227; Wed, 11 May 2016 22:50:57 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id u4BKotgS021226; Wed, 11 May 2016 22:50:55 +0200 Date: Wed, 11 May 2016 20:51:00 -0000 From: Jakub Jelinek To: Marek Polacek Cc: GCC Patches Subject: Re: [PATCH] Fix crash with --help=^ (PR driver/71063) Message-ID: <20160511205055.GT28550@tucnak.redhat.com> Reply-To: Jakub Jelinek References: <20160511204036.GJ20450@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160511204036.GJ20450@redhat.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-IsSubscribed: yes X-SW-Source: 2016-05/txt/msg00867.txt.bz2 On Wed, May 11, 2016 at 10:40:36PM +0200, Marek Polacek wrote: > We crashed when given --help=^ and Kyrill explained why in the PR > (). The following > seems as good a fix as any, I think. > > Bootstrapped/regtested on x86_64-linux, ok for trunk? > > 2016-05-11 Marek Polacek > > PR driver/71063 > * opts.c (common_handle_option): Detect missing argument for --help^. > > * gcc.dg/opts-7.c: New test. Ok. But while touching this, can you fix the formatting around too? space between * and a, or ++ a, or & exclude_flags? > > diff --git gcc/opts.c gcc/opts.c > index 0f9431a..71e0779 100644 > --- gcc/opts.c > +++ gcc/opts.c > @@ -1640,6 +1640,11 @@ common_handle_option (struct gcc_options *opts, > if (* a == '^') > { > ++ a; > + if (*a == '\0') > + { > + error_at (loc, "missing argument to %qs", "--help=^"); > + break; > + } > pflags = & exclude_flags; > } > else Jakub