diff options
author | Jan Beulich <jbeulich@suse.com> | 2021-06-15 07:57:11 +0200 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2021-06-15 07:57:11 +0200 |
commit | cc0f96357e0b5bce4a1f02910cec2dd66e8990c5 (patch) | |
tree | 5acb7dbf985bd464e6c24e64ab02a49fd4fb4780 /gas/config | |
parent | 93df3340fd5ad32f784214fc125de71811da72ff (diff) | |
download | fsf-binutils-gdb-cc0f96357e0b5bce4a1f02910cec2dd66e8990c5.zip fsf-binutils-gdb-cc0f96357e0b5bce4a1f02910cec2dd66e8990c5.tar.gz fsf-binutils-gdb-cc0f96357e0b5bce4a1f02910cec2dd66e8990c5.tar.bz2 |
x86: permit parenthesized expressions again as addressing scale factor
The description of e68c3d59acd0 ("x86: better respect quotes in
parse_operands()") wrongly states:
"In i386_att_operand(), which needs adjustment to remain in sync, besides
respecting double quotes now, also change the logic such that we don't
count parentheses anymore: Finding any opening or closing parenthesis or
any double quote means we're done, because the subsequent parsing code
wouldn't accept (extra) instances of these anyway."
I didn't pay attention to the possibility of the scale factor being
specified as an expression, which may contain parentheses. Thanks to
Martin for pointing this out. Restore prior behavior or matching
parentheses (backwards), while giving the variable a more suitable name.
Note that this simple and immediate fix is not ging to be enough: This
expression could itself involve quoted symbols. However, to address this
backwards parsing needs to be done away with altogether here (such that
parentheses which are part of such a quoted symbol name can also
properly be accounted for), which is going to be a more intrusive
change.
Diffstat (limited to 'gas/config')
-rw-r--r-- | gas/config/tc-i386.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index b3f9f31..8585380 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -11566,15 +11566,19 @@ i386_att_operand (char *operand_string) if (*base_string == ')') { char *temp_string; + unsigned int parens_not_balanced = 1; /* We've already checked that the number of left & right ()'s are equal, so this loop will not be infinite. */ do { base_string--; + if (*base_string == ')') + parens_not_balanced++; + if (*base_string == '(') + parens_not_balanced--; } - while (*base_string != '(' && *base_string != ')' - && *base_string != '"'); + while (parens_not_balanced && *base_string != '"'); temp_string = base_string; |