public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH][OBVIOUS] options: check for CL_OPTIMIZATION only for cl_options.
@ 2021-10-03 12:26 Martin Liška
  0 siblings, 0 replies; only message in thread
From: Martin Liška @ 2021-10-03 12:26 UTC (permalink / raw)
  To: gcc-patches

One more obvious fix that unblocks ASAN bootstrap.

Martin

gcc/ChangeLog:

	* toplev.c (toplev::main): Check opt_index if it is a part
	of cl_options.
---
  gcc/toplev.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc/toplev.c b/gcc/toplev.c
index d952319ad95..ec9f998a49b 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.  */
-- 
2.33.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-10-03 12:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-03 12:26 [PATCH][OBVIOUS] options: check for CL_OPTIMIZATION only for cl_options Martin Liška

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).