Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Jun 2011 09:09:23 -0400
From:      Robert Lorentz <robert.lorentz@gmail.com>
To:        Oliver Pinter <oliver.pntr@gmail.com>
Cc:        "freebsd-bugs@freebsd.org" <freebsd-bugs@freebsd.org>
Subject:   Re: bin/157177: primes(1) prints non-prime for numbers &gt; 2^32
Message-ID:  <1FFD5740-1B27-4915-9521-968603FE8A8F@gmail.com>
In-Reply-To: <BANLkTi=abw_3p_59mtPafC2N4cUr2MLvLg@mail.gmail.com>
References:  <201106140400.p5E40OML033995@freefall.freebsd.org> <BANLkTi=abw_3p_59mtPafC2N4cUr2MLvLg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Oliver,

> op@pandora-d ~> uname -m -r -p && primes 4295360520 4295360522 | xargs
> -n 1 factor
> 7.4-STABLE amd64 amd64
> 4295360521: 65539 65539
>=20
>> On FreeBSD 9.0-CURRENT I debugged the source in =3D
>> /usr/ports/math/primegen/work/primegen-0.97 a bit and realized that if I =3D=

>> ran the compiled version in =3D
>> /usr/ports/math/primegen/work/primegen-0.97/primes I got the correct =3D
>> expected results.  However, if I run the installed version in =3D
>> /usr/games/primes, I get the incorrect results.  The binaries in those =3D=

>> two places aren't the same (verified using md5). =3D20
>>=20
>> This appears to be an issue with the port building, probably building in =3D=

>> 32 bit.  If the inputs to primes are interpreted as 32bit then a "low" =3D=

>> of (2^32 + 1) is interpreted as 1, therefore being less than 1000000000, =3D=

>> therefore the code would continue to generate primes, and if this is the =3D=

>> case then I wouldn't be surprised that the prime generation code also =3D=

>> would misbehave.
>>=20

If you run the built binary in the /usr/ports/math/primegen/work/../ path do=
 you get the same results?=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1FFD5740-1B27-4915-9521-968603FE8A8F>