From patchwork Thu Jun 8 18:57:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew MacLeod X-Patchwork-Id: 1792494 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=dtv68trH; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QcYPc5wCqz20Wn for ; Fri, 9 Jun 2023 04:57:56 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 968C63856607 for ; Thu, 8 Jun 2023 18:57:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 968C63856607 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1686250674; bh=/1WXQmSbmVi0Nbsuc+wSrPlTdXQbs1erfXUTrZ+ozcc=; h=Date:To:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=dtv68trHKMBU0tDitjDvf0Zw0Ct+5fdgx1UZZjmE6gQqsqmCsQ8t4mcVQYmcjEr/x uKt5bqiLadCn8xjIGZYcO/ge24b9VyDvlGWD+eCdOt1fvyhmtWnrDXgDhibGGuiRO4 UCzGPf9D4QusBKz9J8HYrVI1BEj0vaTQd+SQFrO4= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 6DC553858C2F for ; Thu, 8 Jun 2023 18:57:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6DC553858C2F Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-266-f8tZeONbMRms0PDzKrwPAw-1; Thu, 08 Jun 2023 14:57:29 -0400 X-MC-Unique: f8tZeONbMRms0PDzKrwPAw-1 Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-75d53bab5a9so122640385a.2 for ; Thu, 08 Jun 2023 11:57:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686250648; x=1688842648; h=subject:from:cc:to:content-language:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=+ytaaAmFtUr9NVSD7a97rSULIv9DomOYNxx5jtVk98w=; b=BAutUs1O0ftTFW+4+pzFwS0pMWKLGPYfyhmpQLfADJr956WQrjNO48oSyKZzWKUuUL q+Y3+YZQgSo5l2BVSNTAQbLJCKTlROhzsrVi5DBnaH5vJpkKXKFFPspvT5D8qVeiB5ja 0Xrq3YZnVUojH15xspaFqws2RdTQ0blLNe0KitHzRwJtZflQc86JQJEEiC0jKDmFpKu9 waMUGCnYewUCavyPYtq9anjn4qV/eWRVJfHlI4tdG/tQ2j4Ia7EWuQ8bdAp8zVHg/nXg fNK8JiJT9hpt5S71X4lJsW04Pc3WJ3YyD0kCUAUJCURwZvxJ87NfEaMRzU6FukyGn2Oz sM7A== X-Gm-Message-State: AC+VfDwuwk5hDa6jmzQFxNTTJJrx0XZMZon0gC0+dWv3HVgAvhouuQtz eRiWdfj+RT9kT4QGR6DEG4BrIGVLg/YouJyTAKOR7UACbDEQjh7S5oAH6iD6Vqm9LpqP9dJe3X4 wOdJaAG4W+rr9RRKEpdV5PjYI6ZLKFw6hSHpSQmIvaAfilQAjF6tVLpORXh/YtMsDILsc/4UGq4 7teA== X-Received: by 2002:ac8:5741:0:b0:3f6:c609:e9da with SMTP id 1-20020ac85741000000b003f6c609e9damr9107987qtx.44.1686250648690; Thu, 08 Jun 2023 11:57:28 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ44e1t6cZiZPkkNyULL6Mr27wty6WdypN+NEtmyBG80RDwHZNrzGDrSc0iUz1M3OieQ2CaRLg== X-Received: by 2002:ac8:5741:0:b0:3f6:c609:e9da with SMTP id 1-20020ac85741000000b003f6c609e9damr9107962qtx.44.1686250648367; Thu, 08 Jun 2023 11:57:28 -0700 (PDT) Received: from ?IPV6:2607:fea8:51df:4200::ca58? ([2607:fea8:51df:4200::ca58]) by smtp.gmail.com with ESMTPSA id x12-20020ac84d4c000000b003e302c1f498sm561839qtv.37.2023.06.08.11.57.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 08 Jun 2023 11:57:27 -0700 (PDT) Message-ID: Date: Thu, 8 Jun 2023 14:57:26 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 To: gcc-patches Cc: "hernandez, aldy" Subject: [COMMITTED 1/4] Fix floating point bug in fold_range. X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Andrew MacLeod via Gcc-patches From: Andrew MacLeod Reply-To: Andrew MacLeod Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" We currently do not have any floating point operators where operand 1 is a different type than the LHS. When we eventually do there is a bug in fold_range. If either operand is a known NAN, it returns a NAN of the type of operand 1 instead of the result type. This patch sets it to the correct type. Bootstraps on build-x86_64-pc-linux-gnu with no regressions. Pushed. Andrew From ff0ef34aa04f7767933541f58f016600a3462c84 Mon Sep 17 00:00:00 2001 From: Andrew MacLeod Date: Wed, 7 Jun 2023 14:03:35 -0400 Subject: [PATCH 1/4] Fix floating point bug in fold_range. We currently do not have any floating point operators where operand 1 is a different type than the LHS. When we eventually do there is a bug in fold_range. If either operand is a known NAN, it returns a NAN of the type of operand 1 instead of the result type. * range-op-float.cc (range_operator_float::fold_range): Return NAN of the result type. --- gcc/range-op-float.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/range-op-float.cc b/gcc/range-op-float.cc index a99a6b01ed8..af598b60a79 100644 --- a/gcc/range-op-float.cc +++ b/gcc/range-op-float.cc @@ -57,7 +57,7 @@ range_operator_float::fold_range (frange &r, tree type, return true; if (op1.known_isnan () || op2.known_isnan ()) { - r.set_nan (op1.type ()); + r.set_nan (type); return true; } -- 2.40.1