From owner-freebsd-bugs Mon Aug 12 1:41:49 2002 Delivered-To: freebsd-bugs@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 58EB937B400 for ; Mon, 12 Aug 2002 01:41:46 -0700 (PDT) Received: from xkulesh.vol.cz (xkulesh.vol.cz [195.250.154.106]) by mx1.FreeBSD.org (Postfix) with ESMTP id D059A43E3B for ; Mon, 12 Aug 2002 01:41:44 -0700 (PDT) (envelope-from dan@obluda.cz) Received: from obluda.cz (localhost [127.0.0.1]) by xkulesh.vol.cz (8.12.5/8.12.5) with ESMTP id g7C8ZEp6000383; Mon, 12 Aug 2002 10:35:14 +0200 (CEST) (envelope-from dan@obluda.cz) Message-ID: <3D5772CD.7000908@obluda.cz> Date: Mon, 12 Aug 2002 10:33:17 +0200 From: Dan Lukes User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.0rc3) Gecko/20020524 X-Accept-Language: en, cs MIME-Version: 1.0 To: David Malone Cc: freebsd-bugs@FreeBSD.org, bde@FreeBSD.org Subject: Re: bin/40209: __dtoa broken with -O2 or -O3 optimisation References: <200207150140.g6F1e4SI056496@freefall.freebsd.org> <20020811212701.GA95745@walton.maths.tcd.ie> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit 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 My knowledge about (optimization of) compilation theory isn't sufficient. I never listen about "aliasing rules". Where I can found something to read about it ? Despite of it, it is posible and not so expensive to detect that LHS point to the same place as another variable, so gcc should know about dependency between "x" and wordX(x). E.g., it construct may violate something, but gcc shall detect it and (at least) warn. Well, back to main problem. Yes, it works. Patch follow: *** lib/libc/stdlib/strtod.c.ORIG Tue May 28 18:59:40 2002 --- lib/libc/stdlib/strtod.c Mon Aug 12 10:23:52 2002 *************** *** 222,233 **** Only one of IEEE_LITTLE_ENDIAN, IEEE_BIG_ENDIAN, VAX, or IBM should be defined. #endif #ifdef IEEE_LITTLE_ENDIAN ! #define word0(x) ((ULong *)&x)[1] ! #define word1(x) ((ULong *)&x)[0] #else ! #define word0(x) ((ULong *)&x)[0] ! #define word1(x) ((ULong *)&x)[1] #endif /* The following definition of Storeinc is appropriate for MIPS processors. --- 222,237 ---- Only one of IEEE_LITTLE_ENDIAN, IEEE_BIG_ENDIAN, VAX, or IBM should be defined. #endif + union doubleasulongs { + double x; + ULong w[2]; + }; #ifdef IEEE_LITTLE_ENDIAN ! #define word0(x) (((union doubleasulongs *)&x)->w)[1] ! #define word1(x) (((union doubleasulongs *)&x)->w)[0] #else ! #define word0(x) (((union doubleasulongs *)&x)->w)[0] ! #define word1(x) (((union doubleasulongs *)&x)->w)[1] #endif /* The following definition of Storeinc is appropriate for MIPS processors. -- Dan Lukes tel: +420 2 21914205, fax: +420 2 21914206 root of FIONet, KolejNET, webmaster of www.freebsd.cz AKA: dan@obluda.cz, dan@freebsd.cz,dan@kolej.mff.cuni.cz To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message