From: Martin Liska Date: Sun, 3 Oct 2021 12:25:11 +0000 (+0200) Subject: options: check for CL_OPTIMIZATION only for cl_options. X-Git-Tag: basepoints/gcc-13~4215 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8fbe1b18ed090a026d08f0b0e5f8cd56d652125d;p=thirdparty%2Fgcc.git options: check for CL_OPTIMIZATION only for cl_options. gcc/ChangeLog: * toplev.c (toplev::main): Check opt_index if it is a part of cl_options. --- diff --git a/gcc/toplev.c b/gcc/toplev.c index d952319ad95b..ec9f998a49bb 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -2339,7 +2339,8 @@ toplev::main (int argc, char **argv) /* Save Optimization decoded options. */ for (unsigned i = 1; i < save_decoded_options_count; ++i) - if (cl_options[save_decoded_options[i].opt_index].flags & CL_OPTIMIZATION) + if (save_decoded_options[i].opt_index < cl_options_count + && cl_options[save_decoded_options[i].opt_index].flags & CL_OPTIMIZATION) save_opt_decoded_options.safe_push (save_decoded_options[i]); /* Perform language-specific options initialization. */