From patchwork Thu Jul 30 11:19:51 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 502083 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 2724E1402D6 for ; Thu, 30 Jul 2015 21:20:03 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=t5M8pOjB; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; q=dns; s=default; b=bqLbspKs8meYWNERUbg70yZ8bNdxpowRp4FiEjvHaG3NmSR/dW xTKXhI5J3u7cK8jqicJySbGxRuFPpuh503Kr9hHw9nVvTtinhEt+cbnxgVZfwSAI hLo634/ct5hbi4XqPAzmcIM+MQI2BTeBoZlcv8sKMcko2zeMGMgvDnkl0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; s= default; bh=Fhpz7Ali2zbSQCR/qXQNo9xEpW4=; b=t5M8pOjBLGRp48lSi8lW LNWUy2HMplzcQTLaRwuJ04eVEyMgoNaQP/xZ6bXyMYlVrNtK7Vor8cNqCHmJH5O1 A0Ptm7WtCG7Ckhth1vATFnheZwiqvTq8AEqahoRfLaVNT/SX2Gu8WScEReH3fkwo wdAsCzy4J1RDvsE7JTI/IO0= Received: (qmail 19335 invoked by alias); 30 Jul 2015 11:19:57 -0000 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 Received: (qmail 19324 invoked by uid 89); 30 Jul 2015 11:19:56 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.8 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx2.suse.de Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (CAMELLIA256-SHA encrypted) ESMTPS; Thu, 30 Jul 2015 11:19:55 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 689E2AC22; Thu, 30 Jul 2015 11:19:52 +0000 (UTC) Date: Thu, 30 Jul 2015 13:19:51 +0200 (CEST) From: Richard Biener To: gcc-patches@gcc.gnu.org cc: "Joseph S. Myers" Subject: [PATCH] Fix PR67052 Message-ID: User-Agent: Alpine 2.11 (LSU 23 2013-08-11) MIME-Version: 1.0 The following patch avoids folding NaN < 0 to false if -ftrapping-math is in effect. Bootstrap & regtest pending on x86_64-unknown-linux-gnu. Richard. 2015-07-30 Richard Biener PR middle-end/67052 * fold-const.c (fold_binary_loc): Do not fold NaN < 0 to false if FP math can trap. Index: gcc/fold-const.c =================================================================== --- gcc/fold-const.c (revision 226387) +++ gcc/fold-const.c (working copy) @@ -11634,7 +11455,9 @@ fold_binary_loc (location_t loc, /* Convert ABS_EXPR < 0 to false. */ strict_overflow_p = false; if (code == LT_EXPR - && (integer_zerop (arg1) || real_zerop (arg1)) + && (integer_zerop (arg1) + || ((! HONOR_NANS (arg0) || !flag_trapping_math) + && real_zerop (arg1))) && tree_expr_nonnegative_warnv_p (arg0, &strict_overflow_p)) { if (strict_overflow_p)