From owner-cvs-all Wed Jun 5 22:48:54 2002 Delivered-To: cvs-all@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id 2185937B404; Wed, 5 Jun 2002 22:48:45 -0700 (PDT) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id PAA14139; Thu, 6 Jun 2002 15:48:42 +1000 Date: Thu, 6 Jun 2002 15:49:17 +1000 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: "David O'Brien" Cc: cvs-committers@FreeBSD.org, Subject: Re: cvs commit: src UPDATING In-Reply-To: <20020606143319.V10309-100000@gamplex.bde.org> Message-ID: <20020606154302.O10454-100000@gamplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Thu, 6 Jun 2002, Bruce Evans wrote: > Perhaps. It seems to be caused by a very funny bug in printf or scanf or > in related functions in gcc. > > > $ cat foo.c > > int main(void) { return 0; } > > $ /usr/bin/cc -gstabs+ foo.c > > $ ./a.out > > $ /usr/bin/cc -S -gstabs+ foo.c > > $ cat foo.s > > .file "foo.c" > > ..snip.. > > .stabs "",100,0,0,nantext > > nantext: > > "nan" here seems to be be for misparsing ".Letext" as "nan" (numeric > Not a Number). I get "nan" for the label in the stabs line and > "-inftext" for the label itself. "-inf" seems to be for misparsing > something as numeric -Infinity. The bogus label "-inftext" causes > only a warning from the assembler. Linkage fails later because there > is no label "nantext". The cause of the bug is less interesting than the bug. It is just two %L's in an unchecked format string interpreting stack garbage as long doubles. The following seems to be the correct fix: %%% Index: freebsd.h =================================================================== RCS file: /home/ncvs/src/contrib/gcc/config/i386/freebsd.h,v retrieving revision 1.49 diff -u -2 -r1.49 freebsd.h --- freebsd.h 12 May 2002 17:31:12 -0000 1.49 +++ freebsd.h 6 Jun 2002 05:20:41 -0000 @@ -399,5 +400,6 @@ do { \ if (TARGET_ELF) { \ - fprintf ((FILE), "\t.text\n\t.stabs \"\",%d,0,0,%LLetext\n%LLetext:\n", \ + asm_fprintf ((FILE), \ + "\t.text\n\t.stabs \"\",%d,0,0,%LLetext\n%LLetext:\n", \ N_SO); \ } \ %%% %L in asm_fprintf() just just produces "." here. Perhaps asm_printf() should be used in other places that add a target-dependent prefix. It isn't used much, and couldn't be format-checked easily, since its %L and probably other format specifiers conflict with the standard printf ones. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message