Date: Fri, 5 Jul 2002 04:26:51 +0200 (CEST) From: Dan Lukes <dan@obluda.cz> To: FreeBSD-gnats-submit@FreeBSD.org Subject: bin/40209: __dtoa broken with -O2 or -O3 optimisation Message-ID: <200207050226.g652QpV3013194@xkulesh.vol.cz>
next in thread | raw e-mail | index | archive | help
>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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200207050226.g652QpV3013194>