From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 651E13858D32 for ; Sun, 15 Jan 2023 16:54:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 651E13858D32 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1673801642; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5jlhhHNiLmFd0C15v/OQOUlkJ2g3yAVLdf9ifUvrgUs=; b=LtcYF6yVcQnY4BK8pnfANYVbWdPqZFFxofTwGosQ+fm8eykwzcXyFdBq61xASQc0OseUW5 AJvK5NYh1NP3vx+3X+EPdhAEPsfgNMT60CXv45bw64AuEFbKwoYLDtsg4x9ZUMwhW7EjXh USNA3qazSQhRigX8nryHZCDvPkt+tN8= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-597-RhCyw2uNOeKlKqVab2e5ZQ-1; Sun, 15 Jan 2023 11:54:00 -0500 X-MC-Unique: RhCyw2uNOeKlKqVab2e5ZQ-1 Received: by mail-wr1-f69.google.com with SMTP id l8-20020adfc788000000b002bdfe72089cso124854wrg.21 for ; Sun, 15 Jan 2023 08:54:00 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=5jlhhHNiLmFd0C15v/OQOUlkJ2g3yAVLdf9ifUvrgUs=; b=iyzk0w2EBGGeRUfXe2t7BCuP0qNr/mOy6yGZF9vCrV+8HJlK/KwJTefL7AE+r1nMQw NEgEcMDgw9+2P8Q0x8jDzikI3iNAY58Ag0NJrG94XGF7mGmptjuP16+1Kg3fHHjfZA46 YWnmXi0fRluuBbc5rWQao2e8Rg219Y0dfh9MKDrBX69lz9iaIqkawHrqaNKtGp6Z/mX0 0AtYSs1zwmmN2t3LKZkSKd0EV9Aq0qCAqbfP4Xiqfv1UBYOZ79AkizEP5Kurvp8tXYs0 IhGZ6dKR00IQ2NI/7locAS4YAcm7iRI56/mYHtkfsfaNEph6T0G/lpQbfsQrkhISYVah A1cw== X-Gm-Message-State: AFqh2kp/1y7KOOLdsgq2kJ7Q/isZjNu2v7ruLSCgbCR5r3LDRSN6VC0e dw049xFRRV32BUWw6dDRYVmSumUQ3eNuR4SVlDNGx4KYC8FqCX4peNJ7tgH032bHfDiy05Y8QDd cTCeIlM8I+s1hMxDRIw== X-Received: by 2002:adf:fa88:0:b0:2bb:32bd:1dc0 with SMTP id h8-20020adffa88000000b002bb32bd1dc0mr23100677wrr.58.1673801639772; Sun, 15 Jan 2023 08:53:59 -0800 (PST) X-Google-Smtp-Source: AMrXdXvVyPgvU7umlXVXC274tvenJ73xAwIsl/aDlnW/Yac0kF4fnBWtO9xRX0hjDrz6JQ+Mf/gQeA== X-Received: by 2002:adf:fa88:0:b0:2bb:32bd:1dc0 with SMTP id h8-20020adffa88000000b002bb32bd1dc0mr23100670wrr.58.1673801639498; Sun, 15 Jan 2023 08:53:59 -0800 (PST) Received: from [192.168.1.201] ([139.47.35.114]) by smtp.gmail.com with ESMTPSA id n13-20020a5d67cd000000b002bdcce37d31sm11931426wrw.99.2023.01.15.08.53.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 15 Jan 2023 08:53:59 -0800 (PST) Message-ID: <80beeced-456b-d9e4-19f7-d393cef96324@redhat.com> Date: Sun, 15 Jan 2023 17:53:53 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Subject: Re: [PATCH] [PR107608] [range-ops] Avoid folding into INF when flag_trapping_math. To: Jakub Jelinek Cc: Richard Biener , Andrew MacLeod , GCC patches References: <20230115103227.19393-1-aldyh@redhat.com> From: Aldy Hernandez In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 1/15/23 13:18, Jakub Jelinek wrote: > On Sun, Jan 15, 2023 at 11:32:27AM +0100, Aldy Hernandez wrote: >> As discussed in the PR, for trapping math, do not fold overflowing >> operations into +-INF as doing so could elide a trap. >> >> There is a minor adjustment to known_isinf() where it was mistakenly >> returning true for an [infinity U NAN], whereas it should only return >> true when the range is exclusively +INF or -INF. This is benign, as >> there were no users of known_isinf up to now. >> >> I had some testsuite issues with: >> >>> FAIL: c-c++-common/diagnostic-format-sarif-file-4.c -std=gnu++14 scan-sarif-file "text": " int \\\\u6587\\\\u5b57\\\\u5316\\\\u3051 = >>> FAIL: c-c++-common/diagnostic-format-sarif-file-4.c -std=gnu++17 scan-sarif-file "text": " int \\\\u6587\\\\u5b57\\\\u5316\\\\u3051 = >>> FAIL: c-c++-common/diagnostic-format-sarif-file-4.c -std=gnu++20 scan-sarif-file "text": " int \\\\u6587\\\\u5b57\\\\u5316\\\\u3051 = >>> FAIL: c-c++-common/diagnostic-format-sarif-file-4.c -std=gnu++98 scan-sarif-file "text": " int \\\\u6587\\\\u5b57\\\\u5316\\\\u3051 = >>> FAIL: g++.dg/pr71488.C (test for excess errors) >>> FAIL: g++.dg/guality/pr55665.C -O2 -flto -fno-use-linker-plugin -flto-partition=none line 23 p == 40 >>> FAIL: c-c++-common/diagnostic-format-sarif-file-4.c -Wc++-compat scan-sarif-file "text": " int \\\\u6587\\\\u5b57\\\\u5316\\\\u3051 = >> < FAIL: g++.dg/pr71488.C (test for excess errors) >> < FAIL: g++.dg/guality/pr55665.C -O2 -flto -fno-use-linker-plugin -flto-partition=none line 23 p == 40 >>> FAIL: ./index0-out.go execution, -O0 -g -fno-var-tracking-assignments >>> FAIL: go.test/test/fixedbugs/issue27836.dir/Äfoo.go -O -I. (test for excess errors) >>> FAIL: go.test/test/fixedbugs/issue27836.dir/Ämain.go -O -I. (test for excess errors) >> >> But they seem to be transient issues on my machine, as re-running them >> manually don't cause any issues. Also, the tests themselves have >> nothing to do with floats so I don't see how they could be related. >> >> Tested on x86-64 Linux. >> >> I also ran the glibc testsuite (git sources) on x86-64 and this patch >> fixes: >> >> -FAIL: math/test-double-lgamma >> -FAIL: math/test-double-log1p >> -FAIL: math/test-float-lgamma >> -FAIL: math/test-float-log1p >> -FAIL: math/test-float128-catan >> -FAIL: math/test-float128-catanh >> -FAIL: math/test-float128-lgamma >> -FAIL: math/test-float128-log >> -FAIL: math/test-float128-log1p >> -FAIL: math/test-float128-y0 >> -FAIL: math/test-float128-y1 >> -FAIL: math/test-float32-lgamma >> -FAIL: math/test-float32-log1p >> -FAIL: math/test-float32x-lgamma >> -FAIL: math/test-float32x-log1p >> -FAIL: math/test-float64-lgamma >> -FAIL: math/test-float64-log1p >> -FAIL: math/test-float64x-lgamma >> -FAIL: math/test-ldouble-lgamma >> >> OK for trunk? >> >> PR tree-optimization/107608 >> >> gcc/ChangeLog: >> >> * range-op-float.cc (range_operator_float::fold_range): Avoid >> folding into INF when flag_trapping_math. >> * value-range.h (frange::known_isinf): Return false for possible NANs. > > As a workaround this looks ok to me, but we need to figure out something > better for GCC 14. Agreed. I think the underlying problem is that we have little or inconsistent support for propagating floats. It's not a ranger issue, but all the levels above it (and even the gimplifier) which seem to do their own thing wrt when they propagate or not. FWIW, I still think the issue is DCE and friends which are removing trapping statements, but I'm happy to entertain other solutions. Aldy