From owner-freebsd-current Wed Nov 25 12:38:22 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id MAA08333 for freebsd-current-outgoing; Wed, 25 Nov 1998 12:38:22 -0800 (PST) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from ns.mt.sri.com (sri-gw.MT.net [206.127.105.141]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id MAA08157 for ; Wed, 25 Nov 1998 12:38:19 -0800 (PST) (envelope-from nate@mt.sri.com) Received: from mt.sri.com (rocky.mt.sri.com [206.127.76.100]) by ns.mt.sri.com (8.8.8/8.8.8) with SMTP id NAA09604 for ; Wed, 25 Nov 1998 13:38:11 -0700 (MST) (envelope-from nate@rocky.mt.sri.com) Received: by mt.sri.com (SMI-8.6/SMI-SVR4) id NAA10234; Wed, 25 Nov 1998 13:38:11 -0700 Date: Wed, 25 Nov 1998 13:38:11 -0700 Message-Id: <199811252038.NAA10234@mt.sri.com> From: Nate Williams MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: current@FreeBSD.ORG Subject: FWD: src/lib/libc/quad/moddi3.c broken! X-Mailer: VM 6.34 under 19.16 "Lille" XEmacs Lucid Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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 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