From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 452E53857C66; Fri, 6 Oct 2023 17:30:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 452E53857C66 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1696613404; bh=pv9a1Ao+tmnvQ2eozATpicCNy4F4h8OFdBsqfwv2rJo=; h=From:To:Subject:Date:In-Reply-To:References:From; b=K4HVVY14YcakqU4W7V41PIHFW4xbhNsXgihdnp5fEIvGAjEe+MPyMmfE/ieZdKvA5 mP6lsDqaGzV250MJu6xK3aIo+nblAakoiVjfO1g9oENE0Hg8Z1ltkHdieIb/oOGRBn 1cfJ5G4TO8rpVrTbqoZ+OvaUBwub1zQ/d12Jitsk= From: "amacleod at redhat dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/111694] [13/14 Regression] Wrong behavior for signbit of negative zero when optimizing Date: Fri, 06 Oct 2023 17:30:03 +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.2.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: amacleod at redhat dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.3 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: 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=3D111694 --- Comment #4 from Andrew Macleod --- (In reply to Richard Biener from comment #3) > Looks like some frange / relation mistake then. l_3(D) [frange] double [-Inf, +Inf] Equivalence set : [l_3(D), r_4(D)] : _1 =3D __builtin_signbit (l_3(D)); if (_1 !=3D 0) goto ; [INV] else goto ; [INV] 3->6 (T) _1 : [irange] int [-INF, -1][1, +INF] 3->6 (T) l_3(D) : [frange] double [-Inf, -0.0 (-0x0.0p+0)] 3->4 (F) _1 : [irange] int [0, 0] 3->4 (F) l_3(D) : [frange] double [0.0 (0x0.0p+0), +Inf] : _2 =3D __builtin_signbit (r_4(D)); Yeah, we know l_3 and r_4 are equivalent, and we also know that on the edge 3->4 l_3 has the range double [0.0 (0x0.0p+0), +Inf] When we miss is that with an equivalence, we also have to put -0.0 back into the range. We currently don't so we think we can fold the second signbit c= all. If I fix that, we then see=20 r_4(D) [frange] double [-0.0 (-0x0.0p+0), +Inf] which prevents the folding.=20=20 I need to audit to see if there are other places where we may have to "adju= st" equivalence range, or how best to deal with this in the general case.=