public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Martin Liska <marxin@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc(refs/users/marxin/heads/global-options-checking-v3)] Save and restore also cl_target_option.
Date: Wed, 18 Mar 2020 10:18:21 +0000 (GMT)	[thread overview]
Message-ID: <20200318101821.D370C3944420@sourceware.org> (raw)

https://gcc.gnu.org/g:e95d4200b4280609f22e182c65e42f50bbac72ec

commit e95d4200b4280609f22e182c65e42f50bbac72ec
Author: Martin Liska <mliska@suse.cz>
Date:   Wed Mar 18 11:17:45 2020 +0100

    Save and restore also cl_target_option.

Diff:
---
 gcc/c-family/c-attribs.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/gcc/c-family/c-attribs.c b/gcc/c-family/c-attribs.c
index c99b1256186..70dbf922c37 100644
--- a/gcc/c-family/c-attribs.c
+++ b/gcc/c-family/c-attribs.c
@@ -4441,10 +4441,14 @@ handle_optimize_attribute (tree *node, tree name, tree args,
   else
     {
       struct cl_optimization cur_opts;
+      struct cl_target_option cur_target_opts;
       tree old_opts = DECL_FUNCTION_SPECIFIC_OPTIMIZATION (*node);
 
-      /* Save current options.  */
+      /* Save current options for both optimization and target.  We need
+	 to save target optimization because there can be interaction
+	 in between both these types of options.  */
       cl_optimization_save (&cur_opts, &global_options);
+      cl_target_option_save (&cur_target_opts, &global_options);
 
       /* If we previously had some optimization options, use them as the
 	 default.  */
@@ -4458,7 +4462,8 @@ handle_optimize_attribute (tree *node, tree name, tree args,
       DECL_FUNCTION_SPECIFIC_OPTIMIZATION (*node)
 	= build_optimization_node (&global_options);
 
-      /* Restore current options.  */
+      /* Restore current options for both optimization and target.  */
+      cl_target_option_restore (&global_options, &cur_target_opts);
       cl_optimization_restore (&global_options, &cur_opts);
       if (flag_checking)
 	gcc_assert (gcc_options_check (&saved_global_options, &global_options));


             reply	other threads:[~2020-03-18 10:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-18 10:18 Martin Liska [this message]
2020-03-18 12:21 Martin Liska

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200318101821.D370C3944420@sourceware.org \
    --to=marxin@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).