Hi,

On Wed, 27 Nov 2013 19:49:39, Uros Bizjak wrote:
>
> On Mon, Nov 25, 2013 at 10:08 PM, Sriraman Tallam <tmsri...@google.com> wrote:
>
>> I have attached a patch to fix this bug :
>>
>> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58944
>>
>> A similar problem was also reported here:
>> http://gcc.gnu.org/ml/gcc-patches/2013-11/msg01050.html
>>
>>
>> Recently, ix86_valid_target_attribute_tree in config/i386/i386.c was
>> refactored to not depend on global_options structure and to be able to
>> use any gcc_options structure. One clean way to fix this is by having
>> target_option_default_node save all the default target options which
>> can be restored to any gcc_options structure. The root cause of the
>> above bugs was that ix86_arch_string and ix86_tune_string was not
>> saved in target_option_deault_node in PR58944 and
>> ix86_preferred_stack_boundary_arg was not saved in the latter case.
>>
>> This patch saves all the target options used in i386.opt which are
>> either obtained from the command-line or set to some default. Is this
>> patch alright?
>
> Things looks rather complicated, but I see no other solution that save
> and restore the way you propose.
>
> Please wait 24h if somebody has a different idea, otherwise please go
> ahead and commit the patch to mainline.
>

Maybe you should also look at the handling or preferred_stack_boundary_arg
versus incoming_stack_boundary_arg in ix86_option_override_internal:

Remember ix86_incoming_stack_boundary_arg is defined to
global_options.x_ix86_incoming_stack_boundary_arg.

like this?

  if (opts_set->x_ix86_incoming_stack_boundary_arg)
    {
-      if (ix86_incoming_stack_boundary_arg
+      if (opts->x_ix86_incoming_stack_boundary_arg
          < (TARGET_64BIT_P (opts->x_ix86_isa_flags) ? 4 : 2)
-          || ix86_incoming_stack_boundary_arg> 12)
+         || opts->x_ix86_incoming_stack_boundary_arg> 12)
        error ("-mincoming-stack-boundary=%d is not between %d and 12",
-               ix86_incoming_stack_boundary_arg,
+              opts->x_ix86_incoming_stack_boundary_arg,
               TARGET_64BIT_P (opts->x_ix86_isa_flags) ? 4 : 2);
      else
        {
          ix86_user_incoming_stack_boundary
-            = (1 << ix86_incoming_stack_boundary_arg) * BITS_PER_UNIT;
+           = (1 << opts->x_ix86_incoming_stack_boundary_arg) * BITS_PER_UNIT;
          ix86_incoming_stack_boundary
            = ix86_user_incoming_stack_boundary;
        }

Note however that opts_set always points to global_options_set.
so this logic combines the stat of global_options_set and the 
target_option_default_node.


Bernd.


> Thanks,
> Uros                                    

Reply via email to