From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1851) id D370C3944420; Wed, 18 Mar 2020 10:18:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D370C3944420 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1584526701; bh=OIEZaVT4008JpMAa4KHwVPRTcGPcNB0DXEsqr56uOQc=; h=From:To:Subject:Date:From; b=vkV8wZtfeNgbxZ1du0tlo5KdaRkfKwpwqNo/SKjOvJ3zgyG5J0vTlesgDuFqbCP9W mroXeoSmXfdBFjzIF4xLYxUJb8XyTtmrGSxD4PuQPSGUSUjb42tT+vKbecCua7zHyt ZU7DGTp+YNuYI1Nd9guS09hBn0qnW4nhbxGwukWM= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Martin Liska To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/marxin/heads/global-options-checking-v3)] Save and restore also cl_target_option. X-Act-Checkin: gcc X-Git-Author: Martin Liska X-Git-Refname: refs/users/marxin/heads/global-options-checking-v3 X-Git-Oldrev: bc1f339107476938a650b024cfea8fa201e9828a X-Git-Newrev: e95d4200b4280609f22e182c65e42f50bbac72ec Message-Id: <20200318101821.D370C3944420@sourceware.org> Date: Wed, 18 Mar 2020 10:18:21 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Mar 2020 10:18:21 -0000 https://gcc.gnu.org/g:e95d4200b4280609f22e182c65e42f50bbac72ec commit e95d4200b4280609f22e182c65e42f50bbac72ec Author: Martin Liska 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));