Date: Wed, 25 Nov 1998 13:38:11 -0700 From: Nate Williams <nate@mt.sri.com> To: current@FreeBSD.ORG Subject: FWD: src/lib/libc/quad/moddi3.c broken! Message-ID: <199811252038.NAA10234@mt.sri.com>
next in thread | raw e-mail | index | archive | help
Keith White just fixed a bug in the JDK that turned out to be a bug in
the libc source code. It's not normally seen because the version in
libgcc.a works, and is used before the libc version.
------- start of forwarded message -------
From: Keith White <Keith.White@site.uottawa.ca>
Date: Wed, 25 Nov 1998 15:05:50 -0500 (EST)
> You're a God! How did you figure this out? I kept writing trivial
> programs and couldn't figure out what was going on, since all of my
> trivial programs behaved correctly.
For the curious:
I first did 'nm -op /usr/lib/*.a | egrep moddi3'. This gave
libc.a and libgcc.a. I then compared the source for the two
versions. The version in /usr/src/lib/libc/quad/moddi3.c looked a
little suspicious. To verify the problem, I built the following test
program:
---
main() {
long long a, b, c, d;
a = -12L; b = -5L;
c = a % b;
d = a - (a / b) * b;
printf("long long '%%' %s\n", (c == d) ? "passed" : "failed");
}
---
like this:
cc -o remtest remtest.c
./remtest
long long '%' passed
cc -c remtest.c
ld -r -o x.o remtest.o -lc
cc -o remtest x.o
./remtest
long long '%' failed
Then I was convinced there was a problem with libc. Then a
find javasrc/build -name '*.o' | xargs nm -op | egrep moddi3
gave me the likely candidates in the jdk build tree. The most
critical one being in java/java. Quick check of the GNUmakefile
showed '-lc'...
I suppose this might actually be a true bug with libc.
...keith
--
Keith White, EITI/SITE, University of Ottawa
kwhite@site.uottawa.ca [+1 613 562 5800 x6681] FAX [+1 613 562 5187]
------- end of forwarded message -------
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199811252038.NAA10234>
