From patchwork Mon Jan 2 20:47:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Myers X-Patchwork-Id: 710282 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3tsq123dqcz9ssP for ; Tue, 3 Jan 2017 07:48:38 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="xfMgGlGt"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:mime-version :content-type; q=dns; s=default; b=iQT/MGcPAixoreOXqYX2lDWIjwpSN 9x7r1ovj9DGQZv17TNJv1Yc9Y1gKYojFE1dcgEtJ2I1BInHGe+Gb41nwkV3mkqRm 5DVTFajTC4hiZ1qBYhE0kjKKuF3GTkYIkCuUfROKo9kPjXfCcDYgeqY3LQ+4Ui8B fvg4riCizapH+Y= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:mime-version :content-type; s=default; bh=OaNxekD8gtfjzoJNzD3+srrPaTg=; b=xfM gGlGtob1B/zqu5UA6wtDOevEmaVpUrgeLVsMxH14FuGA7lbe4yKbsX29vQTtWNWs pZalTiZ63NmqFCv690+DaxYKue5fVmYf2A2R/8/lD3uePqGeiN6R04bPd2U+nToq Ldu7SRegRFaajhWSL1nCbrdmpqrD94q1i//2WJ9Y= Received: (qmail 42208 invoked by alias); 2 Jan 2017 20:48:27 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 42155 invoked by uid 89); 2 Jan 2017 20:48:22 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, SPF_PASS, URIBL_RED autolearn=ham version=3.3.2 spammy=UD:fenv.h, fenv.h, fenvh, FE_INVALID X-HELO: relay1.mentorg.com Date: Mon, 2 Jan 2017 20:47:56 +0000 From: Joseph Myers To: Subject: Fix math/test-nearbyint-except for no-exceptions configurations [committed] Message-ID: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 X-ClientProxiedBy: svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) The test math/test-nearbyint-except conditions some of its tests on an EXCEPTION_TESTS call, not not all that need such a condition. This patch fixes it to use such a conditional for all its tests and to return 77 (UNSUPPORTED) if none of the floating-point types tested support exceptions. Tested for mips64 soft float (where the test previously failed and is now UNSUPPORTED); also tested for x86_64 to make sure the test still PASSes in exceptions-supported cases. Committed. 2017-01-02 Joseph Myers * math/test-nearbyint-except.c: Include . (any_supported): New variable. (TEST_FUNC): Return early if !EXCEPTION_TESTS (FLOAT). Otherwise set any_supported. (do_test): Return 77 if no floating-point type supported exceptions. diff --git a/math/test-nearbyint-except.c b/math/test-nearbyint-except.c index 61b999f..e33846c 100644 --- a/math/test-nearbyint-except.c +++ b/math/test-nearbyint-except.c @@ -18,6 +18,7 @@ #include #include +#include #include #include @@ -26,11 +27,16 @@ # define FE_INVALID 0 #endif +static bool any_supported = false; + #define TEST_FUNC(NAME, FLOAT, SUFFIX) \ static int \ NAME (void) \ { \ int result = 0; \ + if (!EXCEPTION_TESTS (FLOAT)) \ + return 0; \ + any_supported = true; \ volatile FLOAT a, b __attribute__ ((unused)); \ a = 1.0; \ /* nearbyint must not clear already-raised exceptions. */ \ @@ -44,7 +50,7 @@ NAME (void) \ result = 1; \ } \ /* But it mustn't lose exceptions from sNaN arguments. */ \ - if (SNAN_TESTS (FLOAT) && EXCEPTION_TESTS (FLOAT)) \ + if (SNAN_TESTS (FLOAT)) \ { \ static volatile FLOAT snan = __builtin_nans ## SUFFIX (""); \ volatile FLOAT c __attribute__ ((unused)); \ @@ -75,6 +81,8 @@ do_test (void) #ifndef NO_LONG_DOUBLE result |= ldouble_test (); #endif + if (!any_supported) + return 77; return result; }