Date: 20 Dec 2002 21:24:39 -0500 From: Joe Marcus Clarke <marcus@marcuscom.com> To: current@freebsd.org Subject: WEIRD! div() broken on -CURRENT? Message-ID: <1040437478.29101.23.camel@shumai.marcuscom.com>
next in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
Okay, I must be losing my mind. Does anyone know why the following
program compiled with stock gcc-3.2.1, stock CFLAGS, and no CPUTYPE
produces:
ddy.quot = 1
ddy.rem = -1077937744
on -CURRENT, and:
ddy.quot = 8
ddy.rem = 0
On -stable?
#include <stdlib.h>
#include <stdio.h>
main(void) {
div_t ddy;
int dy, dy_frac;
ddy = div (768, 96);
dy = ddy.quot;
dy_frac = ddy.rem;
printf("ddy.quot = %d\n", dy);
printf("ddy.rem = %d\n", dy_frac);
return 0;
}
> cc -O -pipe -o xxx xxx.c
I'm doing something wrong, right? I mean, this can't be right. I've
verified this now on a P4 running:
FreeBSD jclarke-pc.cisco.com 5.0-RC FreeBSD 5.0-RC #0: Mon Dec 16
02:54:55 EST 2002
marcus@jclarke-pc.cisco.com:/usr/obj/usr/src/sys/JCLARKE-PC i386
And a PIII running:
FreeBSD sysinfo.mezzweb.com 5.0-CURRENT FreeBSD 5.0-CURRENT #0: Mon Dec
16 09:44:28 CST 2002
root@sysinfo.mezzweb.com:/usr/src/sys/i386/compile/BSDROCKS i386
Both machines produce the same result, while my -stable machines produce
the correct result. Both machines have fresh -CURRENT headers. Oh, and
if I move the xxx binary from my -stable machine to my -CURRENT machine,
it produces the correct result. Both machines have WITNESS and
INVARIANTS disabled. The PIII has MATH_EMULATE compiled in, but the P4
does not. Any help would be most appreciated as I think this is causing
Nautilus crashes on -CURRENT. Thanks.
Joe
--
PGP Key : http://www.marcuscom.com/pgp.asc
[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (FreeBSD)
iD8DBQA+A9Dmb2iPiv4Uz4cRAnhbAKCMNuyAM9FhZGQsyMaZjNMiDEn2PgCfSlZn
wAjQe/YSguti6SEFcFMfiNE=
=O6Ak
-----END PGP SIGNATURE-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1040437478.29101.23.camel>
