From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 613113858C5E; Tue, 11 Jul 2023 06:28:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 613113858C5E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1689056910; bh=mRjSiNPK/ptZ/Too3umtabum9WZ1pbp1P/AZQUPC44s=; h=From:To:Subject:Date:From; b=xD4a9TDKOqNudGQDMpDda6bGR0KVfA+GWHwo8sv6MSVbCwpboCcnLg855uyNlcz38 CYIg0xZ9+p44isoiAuO4owy9XZy2ZtKcIVMjQuB8OAIQ24byDdpZufq1JB2N/tDair GZZI8NGnIP5NvNd38hik8lT4NdHjMHTb0Y1IGGxI= From: "malat at debian dot org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/110622] New: x86: Miscompilation at O1 level (O0 is working) Date: Tue, 11 Jul 2023 06:28:29 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 13.1.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: malat at debian dot org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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=3D110622 Bug ID: 110622 Summary: x86: Miscompilation at O1 level (O0 is working) Product: gcc Version: 13.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: malat at debian dot org Target Milestone: --- I can trigger an assertion in highway unit test suite on Debian/i386 when u= sing -O1 (does not happen at -O0). Symptoms: [...] f32x2: Log1p(5.5968112995194757e-20) expected 5.5968112995194757e-20 actual= 0 ulp 5.28754e+08 max ulp 3 [...] For some reason the code return exactly zero (0) during a math computation = of a log1p function. The code runs fine at O2 on all other Debian arches (amd64, mipsel, armel, ppc32 ...). Since the return value is exactly 0, I suspect this is not a case of excess precision (x87). This is not a hardware issue as I can reproduce it on mult= iple hosts (Debian buildds machine, and x86 porterbox). If I extract the math logic and call it in a `main` function, then the comp= iler is able to optimize the code correctly (even at O2) and return appropriate result (correct tolerance). I did not observe any suspicious behavior under valgrind and/or -fsanitize.=