public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH][PUSHED] options: fix ASAN issue during saving of opt. options
@ 2021-10-02  9:09 Martin Liška
  0 siblings, 0 replies; only message in thread
From: Martin Liška @ 2021-10-02  9:09 UTC (permalink / raw)
  To: gcc-patches

Fix an obvious issue when processing save_decoded_options.

Patch can bootstrap on x86_64-linux-gnu and survives regression tests.

Thanks,
Martin

gcc/ChangeLog:

	* toplev.c (toplev::main): save_decoded_options[0] is program
	name and so it should be skipped.
---
  gcc/toplev.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/toplev.c b/gcc/toplev.c
index 78bb7e9749b..d952319ad95 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -2338,7 +2338,7 @@ toplev::main (int argc, char **argv)
  						&save_decoded_options_count);
  
    /* Save Optimization decoded options.  */
-  for (unsigned i = 0; i < save_decoded_options_count; ++i)
+  for (unsigned i = 1; i < save_decoded_options_count; ++i)
      if (cl_options[save_decoded_options[i].opt_index].flags & CL_OPTIMIZATION)
        save_opt_decoded_options.safe_push (save_decoded_options[i]);
  
-- 
2.33.0


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

only message in thread, other threads:[~2021-10-02  9:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-02  9:09 [PATCH][PUSHED] options: fix ASAN issue during saving of opt. 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).