diff options
author | Alan Modra <amodra@gmail.com> | 2010-08-02 13:19:44 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2010-08-02 13:19:44 +0000 |
commit | 93d90f466b0a6faa6a7811187139f66a2b9c9c74 (patch) | |
tree | 85e142a800851131e9b31396f45fb7cbea900c96 /gas/read.c | |
parent | 5f1ab67afc4b968ef1de25b13f644fd20ac029d9 (diff) | |
download | gdb-93d90f466b0a6faa6a7811187139f66a2b9c9c74.zip gdb-93d90f466b0a6faa6a7811187139f66a2b9c9c74.tar.gz gdb-93d90f466b0a6faa6a7811187139f66a2b9c9c74.tar.bz2 |
PR gas/11867
* expr.c (operand <'-' and '~'>): Widen bignums.
(operand <'!'>): Correct bignum result and convert to O_constant.
* read.c (emit_expr): Don't assert on .byte bignum. Don't display
bignum truncated warning for sign extended bignums.
Diffstat (limited to 'gas/read.c')
-rw-r--r-- | gas/read.c | 23 |
1 files changed, 20 insertions, 3 deletions
@@ -4263,15 +4263,32 @@ emit_expr (expressionS *exp, unsigned int nbytes) unsigned int size; LITTLENUM_TYPE *nums; - know (nbytes % CHARS_PER_LITTLENUM == 0); - size = exp->X_add_number * CHARS_PER_LITTLENUM; if (nbytes < size) { - as_warn (_("bignum truncated to %d bytes"), nbytes); + int i = nbytes / CHARS_PER_LITTLENUM; + if (i != 0) + { + LITTLENUM_TYPE sign = 0; + if ((generic_bignum[--i] + & (1 << (LITTLENUM_NUMBER_OF_BITS - 1))) != 0) + sign = ~(LITTLENUM_TYPE) 0; + while (++i < exp->X_add_number) + if (generic_bignum[i] != sign) + break; + } + if (i < exp->X_add_number) + as_warn (_("bignum truncated to %d bytes"), nbytes); size = nbytes; } + if (nbytes == 1) + { + md_number_to_chars (p, (valueT) generic_bignum[0], 1); + return; + } + know (nbytes % CHARS_PER_LITTLENUM == 0); + if (target_big_endian) { while (nbytes > size) |