diff --git a/gcc/opts.c b/gcc/opts.c index 296f0f61802..3639edf4cd7 100644 --- a/gcc/opts.c +++ b/gcc/opts.c @@ -2821,6 +2821,14 @@ common_handle_option (struct gcc_options *opts, opts->x_flag_lto = value ? "" : NULL; break; + case OPT_flto_: + if (strcmp (arg, "none") != 0 + && strcmp (arg, "jobserver") != 0 + && atoi (arg) == 0) + error_at (loc, + "unrecognized argument to %<-flto=%> option: %qs", arg); + break; + case OPT_w: dc->dc_inhibit_warnings = true; break; diff --git a/gcc/testsuite/gcc.dg/spellcheck-options-21.c b/gcc/testsuite/gcc.dg/spellcheck-options-21.c new file mode 100644 index 00000000000..3e0e8a8ebaf --- /dev/null +++ b/gcc/testsuite/gcc.dg/spellcheck-options-21.c @@ -0,0 +1,3 @@ +/* { dg-do compile } */ +/* { dg-options "-flto=sparta" } */ +/* { dg-error "unrecognized argument to '-flto=' option: 'sparta'" "" { target *-*-* } 0 } */