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

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

signed/unsigned issue in "as".


From: Rogier Wolff
Subject: signed/unsigned issue in "as".
Date: Tue, 14 Aug 2001 21:55:46 +0200 (MEST)

Hi, 

as problem. 

/home/wolff> rpm -qf `which as`
binutils-2.9.1.0.25-11

This program (when compiled with -static): 
----------------------------------------------------

#include <stdio.h>

#ifndef DIM
/* This one works... */
#define DIM 234800000
#endif

/*  works if dimension is 234800000, not if 234900000 */
static float a1[DIM];


int main()
{
  static long int i;

  printf ("I will run  !\n");

  for (i =0; i < DIM; i++) {
    a1[i] = (float).33333333333333331;
  }
  printf ("I am done !\n");
  exit (0);
} 

------------------------

works up to the point where the size of the "a1" array overflows 2G.

At that point the relevant part of the assembly looks something like:

        .local  a1
        .comm   a1,2147600000,32


which leads as to report: 

/tmp/ccq1KCWe.s: Assembler messages:
/tmp/ccq1KCWe.s:39: Error: .COMMon length (-2147367296.) <0! Ignored.
/tmp/ccq1KCWe.s:39: Error: Rest of line ignored. First ignored character is `,'.

and of course: -2147367296 + 2 ^32 = 2147600000 ...


Similarly, if I define two arrays which are together larger than the
I get something about .org -ing backwards. 

                                Roger.

-- 
** address@hidden ** http://www.BitWizard.nl/ ** +31-15-2137555 **
*-- BitWizard writes Linux device drivers for any device you may have! --*
* There are old pilots, and there are bold pilots. 
* There are also old, bald pilots. 



reply via email to

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