Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Oct 2004 16:47:14 +0200
From:      Willem Jan Withagen <wjw@withagen.nl>
To:        Georgi Guninski <guninski@guninski.com>
Cc:        freebsd-amd64@freebsd.org
Subject:   Re: two 4GB mallocs => SEGV
Message-ID:  <417E6372.4080006@withagen.nl>
In-Reply-To: <20041026142843.GH2841@sivokote.iziade.m$>
References:  <20041026115041.GE2841@sivokote.iziade.m$> <417E474A.1000401@withagen.nl> <20041026125709.GF1003@straylight.m.ringlet.net> <417E4D6C.4040508@withagen.nl> <20041026133002.GG1003@straylight.m.ringlet.net> <20041026133651.GF2841@sivokote.iziade.m$> <417E565A.5010009@withagen.nl> <20041026142843.GH2841@sivokote.iziade.m$>

next in thread | previous in thread | raw e-mail | index | archive | help
Georgi Guninski wrote:

> On Tue, Oct 26, 2004 at 03:51:22PM +0200, Willem Jan Withagen wrote:
> 
>>And again on a 5.2 i386 box:
>>[/tmp] root@freebee> a.out
>>80000000
> 
> 
> actually on i386 linux i get 0 and i don't crash at all.

facinating, but true...
Willest compiling I get a warning of a overflow that 2G gives a wrap in long, 
but things are interpreted unsigned as far as I see.
And that is because I changed your 4G to 2G, 'cause I only had 2Gb of mem and 
5Gb of swap.

Yours just really overflows to 0, I guess. eg. if the optimizer (or the code) 
calculates the expression from right to left, and *4 is done 'by shiftleft 2'
you're left with an all-zeros...

--WjW



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?417E6372.4080006>