[PATCH] Clean reg class and base_reg for input output operand (%dx).
Jan Beulich
jbeulich@suse.com
Tue Dec 12 08:15:26 GMT 2023
On 12.12.2023 08:51, Cui, Lili wrote:
>>>>> --- a/gas/config/tc-i386.c
>>>>> +++ b/gas/config/tc-i386.c
>>>>> @@ -13016,6 +13016,8 @@ i386_att_operand (char *operand_string)
>>>>> && !operand_type_check (i.types[this_operand], disp))
>>>>> {
>>>>> i.types[this_operand] = i.base_reg->reg_type;
>>>>> + i.types[this_operand].bitfield.class = 0;
>>>>> + i.base_reg = NULL;
>>>>
>>>> I agree with the latter, but I don't understand the former. The more
>>>> that in earlier discussion on the APX subthread I clearly indicated
>>>> what I think needs doing here.
>>>>
>>>
>>> The original issue was that we encountered a segment fault when accessing
>> i.op[op].regs->reg_flags, and since the input was (%dx), we treat it as
>> memory, so I think we need to clean up i.types[this_operand]. bitfield.class =
>> 0 and leave i.base_reg there, it means i.base_reg does not need to be
>> cleaned.
>>
>> As said before - what is missing as far as I understand it is the updating of
>> i.op[].regs in the code above. That ought to be (much) preferred over
>> invalidating .class (and thus perhaps causing new latent issues).
>>
>
> Changed. Can I check in this patch ?
If the change is enough to avoid any respective oddities in the APX
patches, then yes, please go ahead.
Jan
> Clean base_reg and assign correct values to regs for input_output_operand (%dx).
>
> For special processing of input and output operands (%dx),
> the state of some variables needs to be cleaned.
>
> gas/ChangeLog:
>
> * config/tc-i386.c (i386_att_operand): Assign values to regs and
> clean i.base_reg for input output operand (%dx).
>
> diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
> index 4f3864f2ba7..3f1b39baddc 100644
> --- a/gas/config/tc-i386.c
> +++ b/gas/config/tc-i386.c
> @@ -13016,6 +13016,8 @@ i386_att_operand (char *operand_string)
> && !operand_type_check (i.types[this_operand], disp))
> {
> i.types[this_operand] = i.base_reg->reg_type;
> + i.op[this_operand].regs = i.base_reg;
> + i.base_reg = NULL;
> i.input_output_operand = true;
> return 1;
> }
>
> Thanks,
> Lili.
More information about the Binutils
mailing list