From patchwork Fri May 20 13:28:07 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janne Blomqvist X-Patchwork-Id: 96602 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id C02DEB71A1 for ; Fri, 20 May 2011 23:28:25 +1000 (EST) Received: (qmail 26887 invoked by alias); 20 May 2011 13:28:23 -0000 Received: (qmail 26825 invoked by uid 22791); 20 May 2011 13:28:22 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RFC_ABUSE_POST, TW_BG, TW_ZJ X-Spam-Check-By: sourceware.org Received: from mail-px0-f172.google.com (HELO mail-px0-f172.google.com) (209.85.212.172) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 20 May 2011 13:28:08 +0000 Received: by pxi6 with SMTP id 6so2879053pxi.17 for ; Fri, 20 May 2011 06:28:07 -0700 (PDT) MIME-Version: 1.0 Received: by 10.68.15.170 with SMTP id y10mr6908576pbc.364.1305898087683; Fri, 20 May 2011 06:28:07 -0700 (PDT) Received: by 10.68.54.105 with HTTP; Fri, 20 May 2011 06:28:07 -0700 (PDT) Date: Fri, 20 May 2011 16:28:07 +0300 Message-ID: Subject: [Patch, libfortran] PR 48977 -ffpe-trap=denormal on glibc systems From: Janne Blomqvist To: GCC Patches , Fortran List Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Hi, the attached patch makes libgfortran prefer the x86 asm implementation of setting FPU traps instead of using glibc feenableexcept(). This enables to trap on denormals, which glibc doesn't support. Contrary to the original patch in the PR, this swaps only glibc and x86 priorities, as using the x86 implementation on Solaris can cause debugging issues. However, due to the fpu-sysv implementation apparently being broken (PR 48982) Solaris will so far use the x86 implementation as it has done for a long time (that is, this patch should not introduce any new breakage on Solaris). But once 48982 is fixed, this problem should be taken care of as well. Regtested on x86_64-unknown-linux-gnu, Ok for trunk? 2011-05-20 Janne Blomqvist Uros Bizjak PR libfortran/48977 * configure.host: Swap order of glibc and x86 tests. diff --git a/libgfortran/configure.host b/libgfortran/configure.host index eb68c93..92b6433 100644 --- a/libgfortran/configure.host +++ b/libgfortran/configure.host @@ -20,17 +20,17 @@ # DEFAULTS fpu_host='fpu-generic' -# HOST-SPECIFIC OVERRIDES +if test "x${have_feenableexcept}" = "xyes"; then + fpu_host='fpu-glibc' +fi + +# x86 asm should be used instead of glibc, since glibc doesn't support +# the x86 denormal exception. case "${host_cpu}" in i?86 | x86_64) fpu_host='fpu-387' ;; esac -# CONFIGURATION-SPECIFIC OVERRIDES -if test "x${have_feenableexcept}" = "xyes"; then - fpu_host='fpu-glibc' -fi - if test "x${have_fpsetmask}" = "xyes"; then fpu_host='fpu-sysv' fi