From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7499 invoked by alias); 2 Apr 2007 16:43:50 -0000 Received: (qmail 7476 invoked by uid 22791); 2 Apr 2007 16:43:49 -0000 X-Spam-Check-By: sourceware.org Received: from e32.co.us.ibm.com (HELO e32.co.us.ibm.com) (32.97.110.150) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 02 Apr 2007 17:43:45 +0100 Received: from d03relay04.boulder.ibm.com (d03relay04.boulder.ibm.com [9.17.195.106]) by e32.co.us.ibm.com (8.12.11.20060308/8.13.8) with ESMTP id l32GfYTe030665; Mon, 2 Apr 2007 12:41:34 -0400 Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by d03relay04.boulder.ibm.com (8.13.8/8.13.8/NCO v8.3) with ESMTP id l32Ghg5S149100; Mon, 2 Apr 2007 10:43:43 -0600 Received: from d03av02.boulder.ibm.com (loopback [127.0.0.1]) by d03av02.boulder.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id l32Ghgdc015532; Mon, 2 Apr 2007 10:43:42 -0600 Received: from [9.10.86.122] (spokane1.rchland.ibm.com [9.10.86.122]) by d03av02.boulder.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id l32GhfhN015492; Mon, 2 Apr 2007 10:43:42 -0600 Message-ID: <4611368A.3030800@us.ibm.com> Date: Mon, 02 Apr 2007 16:43:00 -0000 From: Steven Munroe User-Agent: Mozilla/5.0 (X11; U; Linux ppc64; en-US; rv:1.8.0.9) Gecko/20060906 SUSE/1.8_seamonkey_1.0.7-1.1 SeaMonkey/1.0.7 MIME-Version: 1.0 To: Jakub Jelinek , libc-ports@sources.redhat.com CC: Glibc hackers , Ulrich Drepper , Peter Eberlein Subject: [PATCH] [PORTS] PPC fenv fixes for soft-fp References: <20070322145345.GZ1826@sunsite.mff.cuni.cz> <4602FCE5.7060203@us.ibm.com> <460941B8.2050501@us.ibm.com> <20070327160708.GA355@devserv.devel.redhat.com> In-Reply-To: <20070327160708.GA355@devserv.devel.redhat.com> Content-Type: multipart/mixed; boundary="------------090403040002010208000106" Mailing-List: contact libc-hacker-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-hacker-owner@sourceware.org X-SW-Source: 2007-04/txt/msg00001.txt.bz2 This is a multi-part message in MIME format. --------------090403040002010208000106 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-length: 762 This change exposes a few bugs in the soft-fp implementations for PPC. The current feholdexcept implementation has where it uses fesetenv to resort the current env: /* Get the current state. */ fegetenv (envp); u.fenv = *envp; /* Clear everything except the rounding mode. */ u.l[0] &= 0x3; /* ?? Should we clear the disabled exceptions as well ?? */ /* Put the new state in effect. */ fesetenv (envp); Which is incorrect. It should disable exceptions and pass the updated env to fesetenv: /* Disable exceptions */ u.l[1] = FE_ALL_EXCEPT; /* Put the new state in effect. */ fesetenv (&u.fenv); Finally the powerpc/nofpu version is missing the libm_hidden_def which results in a link error in make check. The attached patch fixes all of these problems. --------------090403040002010208000106 Content-Type: text/plain; name="ports-feholdexcept-20070320.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="ports-feholdexcept-20070320.txt" Content-length: 1196 2007-04-02 Steven Munroe * sysdeps/powerpc/nofpu/feholdexcpt.c (feholdexcept): Disable exceptions. Use the updated env in fesetenv(). Add libm_hidden_def. diff -urN libc25-cvstip-20070320/ports/sysdeps/powerpc/nofpu/feholdexcpt.c libc25/ports/sysdeps/powerpc/nofpu/feholdexcpt.c --- libc25-cvstip-20070320/ports/sysdeps/powerpc/nofpu/feholdexcpt.c 2002-10-19 15:06:29.000000000 -0500 +++ libc25/ports/sysdeps/powerpc/nofpu/feholdexcpt.c 2007-04-02 10:57:50.350540888 -0500 @@ -1,6 +1,6 @@ /* Store current floating-point environment and clear exceptions (soft-float edition). - Copyright (C) 2002 Free Software Foundation, Inc. + Copyright (C) 2002, 2007 Free Software Foundation, Inc. Contributed by Aldy Hernandez , 2002. This file is part of the GNU C Library. @@ -33,11 +33,12 @@ u.fenv = *envp; /* Clear everything except the rounding mode. */ u.l[0] &= 0x3; - - /* ?? Should we clear the disabled exceptions as well ?? */ + /* Disable exceptions */ + u.l[1] = FE_ALL_EXCEPT; /* Put the new state in effect. */ - fesetenv (envp); + fesetenv (&u.fenv); return 0; } +libm_hidden_def (feholdexcept) --------------090403040002010208000106--