From owner-freebsd-bugs@FreeBSD.ORG Wed May 14 02:42:32 2003 Return-Path: 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 9B74B37B401 for ; Wed, 14 May 2003 02:42:32 -0700 (PDT) Received: from HAL9000.homeunix.com (12-233-57-131.client.attbi.com [12.233.57.131]) by mx1.FreeBSD.org (Postfix) with ESMTP id 03CA443FAF for ; Wed, 14 May 2003 02:42:32 -0700 (PDT) (envelope-from das@FreeBSD.ORG) Received: from HAL9000.homeunix.com (localhost [127.0.0.1]) by HAL9000.homeunix.com (8.12.9/8.12.5) with ESMTP id h4E9gQhO007422; Wed, 14 May 2003 02:42:26 -0700 (PDT) (envelope-from das@FreeBSD.ORG) Received: (from das@localhost) by HAL9000.homeunix.com (8.12.9/8.12.5/Submit) id h4E9gPeH007421; Wed, 14 May 2003 02:42:26 -0700 (PDT) (envelope-from das@FreeBSD.ORG) Date: Wed, 14 May 2003 02:42:25 -0700 From: David Schultz To: Mikhail Teterin Message-ID: <20030514094225.GA7355@HAL9000.homeunix.com> Mail-Followup-To: Mikhail Teterin , freebsd-bugs@FreeBSD.ORG References: <200305131610.h4DGA8vx007871@freefall.freebsd.org> <20030513180417.GA4917@HAL9000.homeunix.com> <200305131630.12451.mi+mx@aldan.algebra.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200305131630.12451.mi+mx@aldan.algebra.com> cc: freebsd-bugs@FreeBSD.ORG Subject: Re: bin/43299: march=pentium4 miscompiles msun/src/e_pow.c X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 May 2003 09:42:32 -0000 On Tue, May 13, 2003, Mikhail Teterin wrote: > It seems like the problem is inside the SET_HIGH_WORD(ax, ix) macro > on line e_pow.c:214, which expands into > into > > do { > ieee_double_shape_type sh_u; > > sh_u.value = (ax); > sh_u.parts.msw = (ix); > (ax) = sh_u.value; > } while (0); > > for whatever reason, if compiled for pentium4 with -O1, the line > > sh_u.value = (ax) > > is SKIPPED -- according to the debugger. ax ends up filled with junk, > which screws everything up afterwards... I'm attaching the simple test > file (the skipped line is 34 in it). If compiled for p3 or for p4 with > -O0, the result is 0.5. When compiled for p4 with -O1, the result > is junk. The junk is persistent -- I'm getting ``5.29463e-315'' on > both FreeBSD (gcc version 3.2.2 20030205) and Linux (gcc version 3.2 > 20020903). The C standard does not make any provisions for type punning, except for chars. However, SET_HIGH_WORD is doing it in the generally accepted way, which gcc claims to support. This looks like a bug in gcc, and you seem to have determined that it is not FreeBSD specific. It should probably be reported to the gcc folks if it is still a problem in a recent gcc 3.3 snapshot. (It's great that you found a short test case; they appreciate that.) BTW, thanks for taking the time to look into this! I don't have a P4 to test on or enough free cycles at the moment.