diff options
author | Alan Modra <amodra@gmail.com> | 2015-08-13 15:55:31 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2015-08-13 15:59:40 +0930 |
commit | c14c7a8a619ce03a7c8f41d1cfac3af728df453b (patch) | |
tree | f55da2d28e51d847171db75718ffb4877411e6d1 /gas | |
parent | 9791c250490d7c3c961860419e4436c758a91a21 (diff) | |
download | gdb-c14c7a8a619ce03a7c8f41d1cfac3af728df453b.zip gdb-c14c7a8a619ce03a7c8f41d1cfac3af728df453b.tar.gz gdb-c14c7a8a619ce03a7c8f41d1cfac3af728df453b.tar.bz2 |
gas 0b vs 0b0 vs 00b
* expr.c (integer_constant): Return O_absent expression if eol.
(operand): For targets with both LOCAL_LABELS_FB and
NUMBERS_WITH_SUFFIX set, treat "0b" not followed by binary
digits as a local label reference. Correct handling of 0b prefix.
If a suffix is not allowed, error on 0B.
Diffstat (limited to 'gas')
-rw-r--r-- | gas/ChangeLog | 9 | ||||
-rw-r--r-- | gas/expr.c | 44 |
2 files changed, 32 insertions, 21 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index d5b29f2..9fa7032 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,4 +1,13 @@ 2015-08-13 Alan Modra <amodra@gmail.com> + DJ Delorie <dj@redhat.com> + + * expr.c (integer_constant): Return O_absent expression if eol. + (operand): For targets with both LOCAL_LABELS_FB and + NUMBERS_WITH_SUFFIX set, treat "0b" not followed by binary + digits as a local label reference. Correct handling of 0b prefix. + If a suffix is not allowed, error on 0B. + +2015-08-13 Alan Modra <amodra@gmail.com> * doc/as.texinfo (Local Labels): Allowed range of N in local labels is non-negative integers, not positive integers. @@ -285,6 +285,12 @@ integer_constant (int radix, expressionS *expressionP) #define valuesize 32 #endif + if (is_end_of_line[(unsigned char) *input_line_pointer]) + { + expressionP->X_op = O_absent; + return; + } + if ((NUMBERS_WITH_SUFFIX || flag_m68k_mri) && radix == 0) { int flt = 0; @@ -832,32 +838,28 @@ operand (expressionS *expressionP, enum expr_mode mode) break; case 'b': - if (LOCAL_LABELS_FB && ! (flag_m68k_mri || NUMBERS_WITH_SUFFIX)) + if (LOCAL_LABELS_FB && !flag_m68k_mri + && input_line_pointer[1] != '0' + && input_line_pointer[1] != '1') { - /* This code used to check for '+' and '-' here, and, in - some conditions, fall through to call - integer_constant. However, that didn't make sense, - as integer_constant only accepts digits. */ - /* Some of our code elsewhere does permit digits greater - than the expected base; for consistency, do the same - here. */ - if (input_line_pointer[1] < '0' - || input_line_pointer[1] > '9') - { - /* Parse this as a back reference to label 0. */ - input_line_pointer--; - integer_constant (10, expressionP); - break; - } - /* Otherwise, parse this as a binary number. */ + /* Parse this as a back reference to label 0. */ + input_line_pointer--; + integer_constant (10, expressionP); + break; } + /* Otherwise, parse this as a binary number. */ /* Fall through. */ case 'B': - input_line_pointer++; + if (input_line_pointer[1] == '0' + || input_line_pointer[1] == '1') + { + input_line_pointer++; + integer_constant (2, expressionP); + break; + } if (flag_m68k_mri || NUMBERS_WITH_SUFFIX) - goto default_case; - integer_constant (2, expressionP); - break; + input_line_pointer++; + goto default_case; case '0': case '1': |