From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9ABD13858CDA; Tue, 10 Jan 2023 10:25:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9ABD13858CDA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1673346303; bh=fy7o/SYKZ2PFJooV80sU/YyK/VI026D+zLDZseXqtWE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=MJS+f9UTcjCOCOX9BT4QrTIRRAsMXzhxwKwQFjFRa0X34kuhN1h55PGSXT1mO9g6W +gmCI4yX6Wi7VFuoqF96oQzhuvetVZpiV5Nil2/c7DYzcSPhDdKVFIKjgSNn+isVr6 aM+MRkh2GZrtt8CGqoXPBnIh+c6gy+ZNHwQVwuNk= From: "aldyh at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/107608] [13 Regression] Failure on fold-overflow-1.c and pr95115.c Date: Tue, 10 Jan 2023 10:25:02 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: missed-optimization, wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: aldyh at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: attachments.created Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107608 --- Comment #16 from Aldy Hernandez --- Created attachment 54224 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D54224&action=3Dedit untested patch Perhaps this would work. It solves the testcase, though I think we should probably audit the operators that don't use the generic range_operator_float::fold_range to make sure they're not doing anything si= lly. Note that we could add similar code whenever we drop to a NAN like const_bi= nop does: /* Don't constant fold this floating point operation if both operands are not NaN but the result is NaN, and flag_trapping_math. Such operations should raise an invalid operation exception. */ if (flag_trapping_math && MODE_HAS_NANS (mode) && REAL_VALUE_ISNAN (result) && !REAL_VALUE_ISNAN (d1) && !REAL_VALUE_ISNAN (d2)) return NULL_TREE; I avoided doing so because an frange of NAN does not count as a singleton s= o it should never be propagated. If this is a problem, I could add a similar tw= eak. What do y'all think?=