bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: as bug with bignums


From: Nick Clifton
Subject: Re: as bug with bignums
Date: 07 Jan 2002 17:45:30 +0000
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/21.1

Hi,

> % cat x.s
> .byte '012345678
> % as x.s
> x.s: Assembler messages:
> x.s:1: Warning: Bignum truncated to 1 bytes
> zsh: segmentation fault  as x.s

Thanks for reporting this bug.  I think that you will find that this
patch will fix the problem.  I will be applying it to the sources
shortly.

Cheers
        Nick

2002-01-07  Nick Clifton  <address@hidden>

        * read.c (emit_expr): Do not allow 'size' or 'nbytes' to go
        negative.

Index: gas/read.c
===================================================================
RCS file: /cvs/src/src/gas/read.c,v
retrieving revision 1.49
diff -p -c -r1.49 read.c
*** read.c      2001/10/12 08:56:17     1.49
--- read.c      2002/01/07 17:48:42
*************** emit_expr (exp, nbytes)
*** 3683,3689 ****
            }
  
          nums = generic_bignum + size / CHARS_PER_LITTLENUM;
!         while (size > 0)
            {
              --nums;
              md_number_to_chars (p, (valueT) *nums, CHARS_PER_LITTLENUM);
--- 3683,3689 ----
            }
  
          nums = generic_bignum + size / CHARS_PER_LITTLENUM;
!         while (size >= CHARS_PER_LITTLENUM)
            {
              --nums;
              md_number_to_chars (p, (valueT) *nums, CHARS_PER_LITTLENUM);
*************** emit_expr (exp, nbytes)
*** 3694,3700 ****
        else
        {
          nums = generic_bignum;
!         while (size > 0)
            {
              md_number_to_chars (p, (valueT) *nums, CHARS_PER_LITTLENUM);
              ++nums;
--- 3694,3700 ----
        else
        {
          nums = generic_bignum;
!         while (size >= CHARS_PER_LITTLENUM)
            {
              md_number_to_chars (p, (valueT) *nums, CHARS_PER_LITTLENUM);
              ++nums;
*************** emit_expr (exp, nbytes)
*** 3703,3709 ****
              nbytes -= CHARS_PER_LITTLENUM;
            }
  
!         while (nbytes > 0)
            {
              md_number_to_chars (p, extra_digit, CHARS_PER_LITTLENUM);
              nbytes -= CHARS_PER_LITTLENUM;
--- 3703,3709 ----
              nbytes -= CHARS_PER_LITTLENUM;
            }
  
!         while (nbytes >= CHARS_PER_LITTLENUM)
            {
              md_number_to_chars (p, extra_digit, CHARS_PER_LITTLENUM);
              nbytes -= CHARS_PER_LITTLENUM;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]