two 4GB mallocs => SEGV
Willem Jan Withagen
wjw at withagen.nl
Tue Oct 26 07:47:21 PDT 2004
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 at freebee> a.out
> 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...
More information about the freebsd-amd64