as.exe: out of memory allocating 4294967280 bytes

Simonov, Vladimir Vladimir.Simonov@acronis.com
Mon Oct 29 08:00:00 GMT 2012


> -----Original Message-----
> From: Alan Modra [mailto:amodra@gmail.com] 
> Sent: Saturday, October 27, 2012 6:27 AM
> To: Simonov, Vladimir
> Cc: binutils@sourceware.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

Hi all,

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. 

Thank you
Vladimir Simonov



More information about the Binutils mailing list