diff options
Diffstat (limited to 'gas/config/tc-i386.c')
-rw-r--r-- | gas/config/tc-i386.c | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index 3435cb5..6d04e83 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -11589,25 +11589,32 @@ i386_att_operand (char *operand_string) if (*base_string == ')') { char *temp_string; - unsigned int parens_not_balanced = 1; + unsigned int parens_not_balanced = 0; + bool in_quotes = false; /* 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--; + equal, and that there's a matching set of double quotes. */ + end_op = base_string; + for (temp_string = op_string; temp_string < end_op; temp_string++) + { + if (*temp_string == '\\' && temp_string[1] == '"') + ++temp_string; + else if (*temp_string == '"') + in_quotes = !in_quotes; + else if (!in_quotes) + { + if (*temp_string == '(' && !parens_not_balanced++) + base_string = temp_string; + if (*temp_string == ')') + --parens_not_balanced; + } } - while (parens_not_balanced && *base_string != '"'); temp_string = base_string; /* Skip past '(' and whitespace. */ - if (*base_string == '(') - ++base_string; + gas_assert (*base_string == '('); + ++base_string; if (is_space_char (*base_string)) ++base_string; |