This is the mail archive of the
mailing list for the binutils project.
RE: as.exe: out of memory allocating 4294967280 bytes
> -----Original Message-----
> From: Alan Modra [mailto:email@example.com]
> Sent: Saturday, October 27, 2012 6:27 AM
> To: Simonov, Vladimir
> Cc: firstname.lastname@example.org
> Subject: Re: as.exe: out of memory allocating 4294967280 bytes
> On Fri, Oct 26, 2012 at 06:13:53PM +0000, Simonov, Vladimir wrote:
> > IMO the problem is in gas\sb.c
> > static void
> > sb_check (sb *ptr, size_t len)
> > ...
> > #if GCC_VERSION >= 3004
> > max = (size_t) 1 << (CHAR_BIT * sizeof (want) - __builtin_clzl (want));
> > #else
> > ...
> > "want" size_t type which is 64-bit. Replace __builtin_clzl with __builtin_clzll fixes the problem.
> > CVS head has the same code. I'm not sure either it my cross tools mis-configuration or real bug in as.
> > If the second, it is strange - the code was committed 4 months ago...
> It's a bug. I didn't consider strange hosts that have sizeof(long) !=
> sizeof(size_t). Does the following fix your problem?
> * sb.c (sb_check): Use __builtin_clzll when size_t is not the
> same size as long.
> Alan Modra
> Australia Development Lab, IBM
Glad to inform you - the both patches work OK for me.
Please decide which one should be committed.
JFYI build platform is mingw64 - 64 bit Windows where long is 32 bit and size_t is 64 bit.
This mimics MS compilers behavior.