From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id CD46B3858CDB; Thu, 30 Mar 2023 07:49:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CD46B3858CDB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1680162541; bh=7EhXYrwxBcL5G8kzyo0ZGCd5A37MyGr/+n80F1y/hxY=; h=From:To:Subject:Date:From; b=Zm2AhcxJe2fxjUeZ28Dn0ko1ExPHX3ggG/j5zh1INwKvnpNWbRwbnkB+1R+iPwRM/ e+c15oQYoiRmBKFt4lgwYdO1gg5M8+43fX9zkRic7yYpVY1tC9HC7hsgCcAMYwOtDt OljQ8d2Zos1uD5kxI89t5xn8MGuwfvJAT1S8Xq3o= From: "albin at yahoo dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/109344] New: feraiseexcept produces incorrect code when optimizations are enabled Date: Thu, 30 Mar 2023 07:49:01 +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: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: albin at yahoo dot com 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=3D109344 Bug ID: 109344 Summary: feraiseexcept produces incorrect code when optimizations are enabled Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: albin at yahoo dot com Target Milestone: --- At -O1, calls to feraiseexcept are inlined. But the inlined code produces incorrect results. See here, only the first function behaves as expected: https://godbolt.org/z/ncc3cjoKh The behavior persists across many versions. (A side note, I don't understand how the first function works, in order to produce a divbyzero exception it appears to divide 0 / 1, not 1 / 0, am I reading the assembly wrong?)=