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  <pola...@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

Reply via email to