This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix crash with --help=^ (PR driver/71063)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Marek Polacek <polacek at redhat dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 11 May 2016 22:50:55 +0200
- Subject: Re: [PATCH] Fix crash with --help=^ (PR driver/71063)
- Authentication-results: sourceware.org; auth=none
- References: <20160511204036 dot GJ20450 at redhat dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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
> (<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71063#c2>). 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 <polacek@redhat.com>
>
> 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