summaryrefslogtreecommitdiff
path: root/gas/read.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2010-08-02 13:19:44 +0000
committerAlan Modra <amodra@bigpond.net.au>2010-08-02 13:19:44 +0000
commita034df24db5b70f4f3202e8a019431ed3de4fa57 (patch)
treea5eadfb5c75a585dbc36c8b90817b7ef4a962107 /gas/read.c
parent5c66e47e123c32d60c30c11c65818b6bccd594c2 (diff)
downloadbinutils-redhat-a034df24db5b70f4f3202e8a019431ed3de4fa57.tar.gz
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.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/gas/read.c b/gas/read.c
index 92371b79f9..bd3fa58bbe 100644
--- a/gas/read.c
+++ b/gas/read.c
@@ -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)