From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5EC0D3858D28; Thu, 26 Jan 2023 12:16:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5EC0D3858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1674735409; bh=BABJfKcDPbLNyj6LbA+d3EfELgYxjYOSWkMp0lCXgPE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=OhVzkH+41JawODl5SuSuHG8zL47Gmjo4Ok9/la3g+mihnykUClgEdEsG+GiDazPR9 JdUnvm4k/ZMJf28tMriUl2iIpwk82dYPWnkOLHhLNhoPAmzLFVm/nrvJJKP3/xmawE 0kYWvkFHw7uOEGIBnHWf5yEK0TuZqBEWcAYcsqPg= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/108540] [13 Regression] Frange miscompilation of ruby since r13-3261 Date: Thu, 26 Jan 2023 12:16:45 +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: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub 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: 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=3D108540 --- Comment #4 from Jakub Jelinek --- Ah, so back_threader::find_taken_edge_cond calls path_range_query::range_of_stmt on the d_1 =3D=3D 0.0 with the assumption that d_1 is -0.0, fold_using_range::range_of_range_op sees (gdb) p debug (range1) [frange] double [-0.0 (-0x0.0p+0), -0.0 (-0x0.0p+0)] (gdb) p debug (range2) [frange] double [0.0 (0x0.0p+0), 0.0 (0x0.0p+0)] (that is correct) and foperator_equal::fold_range is called on those. There we trigger the 604 // We can be sure the values are always equal or not if both rang= es 605 // consist of a single value, and then compare them. 606 else if (op1.singleton_p () && op2.singleton_p ()) 607 { 608 if (op1 =3D=3D op2) 609 r =3D range_true (type); 610 else 611 r =3D range_false (type); 612 } code, which is clearly wrong if both ops are singleton zeros with different sign.=