From owner-freebsd-bugs Thu Jul 4 20:10:19 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C2A4A37B447 for ; Thu, 4 Jul 2002 20:10:03 -0700 (PDT) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0909A43E42 for ; Thu, 4 Jul 2002 20:10:03 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.4/8.12.4) with ESMTP id g653A2JU013298 for ; Thu, 4 Jul 2002 20:10:02 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.4/8.12.4/Submit) id g653A2vh013297; Thu, 4 Jul 2002 20:10:02 -0700 (PDT) Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1CDCD37B400 for ; Thu, 4 Jul 2002 20:01:05 -0700 (PDT) Received: from xkulesh.vol.cz (xkulesh.vol.cz [195.250.154.106]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5C56A43E09 for ; Thu, 4 Jul 2002 20:01:02 -0700 (PDT) (envelope-from dan@obluda.cz) Received: from xkulesh.vol.cz (localhost [127.0.0.1]) by xkulesh.vol.cz (8.12.5/8.12.5) with ESMTP id g6530vR4000266 for ; Fri, 5 Jul 2002 05:00:57 +0200 (CEST) (envelope-from dan@obluda.cz) Received: (from dan@localhost) by xkulesh.vol.cz (8.12.5/8.12.5/Submit) id g652QpV3013194; Fri, 5 Jul 2002 04:26:51 +0200 (CEST) Message-Id: <200207050226.g652QpV3013194@xkulesh.vol.cz> Date: Fri, 5 Jul 2002 04:26:51 +0200 (CEST) From: Dan Lukes Reply-To: Dan Lukes To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: bin/40209: __dtoa broken with -O2 or -O3 optimisation Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 40209 >Category: bin >Synopsis: __dtoa broken with -O2 or -O3 optimisation >Confidential: no >Severity: serious >Priority: high >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Jul 04 20:10:02 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Dan Lukes >Release: FreeBSD 5.0-CURRENT i386 >Organization: Obludarium >Environment: src/lib/libc/stdlib/strtod.c,v 1.21 2002/05/28 16:59:40 gcc version 3.1 [FreeBSD] 20020509 (prerelease) >Description: when you compile libc (or stdlib/strtod.c at least) with -O3 or -O2 then __dtoa is broken. It cause printf malfunction for [eEfFgG] conversions and has huge impact on several system utilities worse scenario - as it damage awk used during buildworld, other unexpected and not so easy trackable problems may occur because some utilities are build from damaged sources It is very dangerous as it doesn't render system unusable (awk's damaged sources cause some warnings only during buildworld). >How-To-Repeat: compile libc with -O2 or -O3 compile and execute printf("'%e' '%f' '%g'\n",(double)10,(double)10,(double)10); you will get ':.000000' ':.000000e+00' ':' It seems to be gcc's optimization problem only. NOTE: __dtoa's spec_case variable is used uninitialised when mode={8,9} spec_case is initialised on lines 2252 and 2254 for modes 0,1,4,5 then it is referenced on 2316 when leftright!=0 e.g. for mode 0,1,4,5,8,9 => => for mode 8,9 spec_case referenced unitinialised NOTE 2: actual 4_RELENG code has no problem even with optimised libc >Fix: I can't present real fix. workaround: Don't put -O2 or -O3 into /etc/make.conf's CFLAGS >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message