[gcc r11-3105] arm: Fix up arm_override_options_after_change_1

Jakub Jelinek jakub@gcc.gnu.org
Thu Sep 10 15:41:16 GMT 2020


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

commit r11-3105-gd9b054d56b052fb01c9a667c95f80c783f0cf0c7
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Sep 10 17:40:08 2020 +0200

    arm: Fix up arm_override_options_after_change_1
    
    Looking further at arm_override_options_after_change_1, it also seems to be
    incorrect, rather than testing
    !opts->x_str_align_functions
    it should be really testing
    !opts_set->x_str_align_functions
    and get &global_options_set or similar passed to it as additional opts_set
    argument.  That is because otherwise the decision will be sticky, while it
    should be done whenever use provided -falign-functions but didn't provide
    -falign-functions= (either on the command line, or through optimize
    attribute or pragma).
    
    Here is a fix for that (incremental change on top of the previous patch).
    
    2020-09-10  Jakub Jelinek  <jakub@redhat.com>
    
            * config/arm/arm.c (arm_override_options_after_change_1): Add opts_set
            argument, test opts_set->x_str_align_functions rather than
            opts->x_str_align_functions.
            (arm_override_options_after_change, arm_option_override_internal,
            arm_set_current_function): Adjust callers.

Diff:
---
 gcc/config/arm/arm.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 37fc15c837f..bae8791dd9a 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -3024,10 +3024,11 @@ static GTY(()) bool thumb_flipper;
 static GTY(()) tree init_optimize;
 
 static void
-arm_override_options_after_change_1 (struct gcc_options *opts)
+arm_override_options_after_change_1 (struct gcc_options *opts,
+				     struct gcc_options *opts_set)
 {
   /* -falign-functions without argument: supply one.  */
-  if (opts->x_flag_align_functions && !opts->x_str_align_functions)
+  if (opts->x_flag_align_functions && !opts_set->x_str_align_functions)
     opts->x_str_align_functions = TARGET_THUMB_P (opts->x_target_flags)
       && opts->x_optimize_size ? "2" : "4";
 }
@@ -3037,7 +3038,7 @@ arm_override_options_after_change_1 (struct gcc_options *opts)
 static void
 arm_override_options_after_change (void)
 {
-  arm_override_options_after_change_1 (&global_options);
+  arm_override_options_after_change_1 (&global_options, &global_options_set);
 }
 
 /* Implement TARGET_OPTION_SAVE.  */
@@ -3065,7 +3066,7 @@ static void
 arm_option_override_internal (struct gcc_options *opts,
 			      struct gcc_options *opts_set)
 {
-  arm_override_options_after_change_1 (opts);
+  arm_override_options_after_change_1 (opts, opts_set);
 
   if (TARGET_INTERWORK && !bitmap_bit_p (arm_active_target.isa, isa_bit_thumb))
     {
@@ -32335,7 +32336,7 @@ arm_set_current_function (tree fndecl)
 
   save_restore_target_globals (new_tree);
 
-  arm_override_options_after_change_1 (&global_options);
+  arm_override_options_after_change_1 (&global_options, &global_options_set);
 }
 
 /* Implement TARGET_OPTION_PRINT.  */


More information about the Gcc-cvs mailing list