From owner-freebsd-bugs Sun Nov 23 22:30:04 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id WAA08429 for bugs-outgoing; Sun, 23 Nov 1997 22:30:04 -0800 (PST) (envelope-from owner-freebsd-bugs) Received: (from gnats@localhost) by hub.freebsd.org (8.8.7/8.8.7) id WAA08423; Sun, 23 Nov 1997 22:30:01 -0800 (PST) (envelope-from gnats) Resent-Date: Sun, 23 Nov 1997 22:30:01 -0800 (PST) Resent-Message-Id: <199711240630.WAA08423@hub.freebsd.org> Resent-From: gnats (GNATS Management) Resent-To: freebsd-bugs Resent-Reply-To: FreeBSD-gnats@FreeBSD.ORG, cagney@tpgi.com.au Received: from oberon.tpgi.com.au (root@oberon.tpgi.com.au [203.12.160.2]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id WAA08024 for ; Sun, 23 Nov 1997 22:21:19 -0800 (PST) (envelope-from cagney@tpgi.com.au) Received: from b1.tpgi.com.au (mel-ppp-093.tpgi.com.au [203.12.163.93]) by oberon.tpgi.com.au (8.7.5/8.7.3) with ESMTP id RAA17700 for ; Mon, 24 Nov 1997 17:21:08 +1100 (EST) Received: (from cagney@localhost) by b1.tpgi.com.au (8.8.7/8.7.3) id NAA18459; Mon, 24 Nov 1997 13:20:27 +1100 (EST) Message-Id: <199711240220.NAA18459@b1.tpgi.com.au> Date: Mon, 24 Nov 1997 13:20:27 +1100 (EST) From: Andrew Cagney Reply-To: cagney@tpgi.com.au To: FreeBSD-gnats-submit@FreeBSD.ORG X-Send-Pr-Version: 3.2 Subject: bin/5135: scanf accepts %Lg but treates it as %g Sender: owner-freebsd-bugs@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk >Number: 5135 >Category: bin >Synopsis: scanf accepts %Lg but treates it as %g >Confidential: no >Severity: critical >Priority: high >Responsible: freebsd-bugs >State: open >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Nov 23 22:30:01 PST 1997 >Last-Modified: >Originator: Andrew Cagney >Organization: >Release: FreeBSD 2.2.5-RELEASE i386 >Environment: Vanilla 2.2.5 >Description: Burried away in the scanf documentation is: L Indicates that the conversion will be efg and the next pointer is a pointer to long double. (This type is not implemented; the L flag is currently ignored.) to be more precise, it assigns a `%g' value (32 bit float or single) to a `%Lg' destination (80 bit long double). I'm sorry but doing this is worse than stupid! >How-To-Repeat: One example, all GDB floating point is broken: $ gdb ... (gdb) print 1.0 $1 = 0 If you trace it through, c-exp.c:parse_number calls sscanf(...%Lg...). >Fix: For FreeBSD: o modify scanf so that for, %Lg (long double) it parses it as %lg (double) then extends/stores it as a long double. o Remove all support for %Lg in both printf and scanf. Some software (eg gdb) tests printf ("%Lg") and then assumes scanf also works. Consequently it is an all or nothing afair :-) For GDB: I'll see if I can get GDB changed so that its configure script separately checks for support of %Lg in scanf and printf. Have a nice day. Andrew >Audit-Trail: >Unformatted: