From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E5D9B3858C33; Wed, 19 Jul 2023 07:18:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E5D9B3858C33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1689751130; bh=aiGaFUaJTd3chLw8yaxntppMeime0JLFHmkVj5foc3E=; h=From:To:Subject:Date:From; b=H8QT6JlKb5hI8x8jKMFQ5ni8mTNtjB6akAHv94KTKPXtnBuBOsajECXVYoLQcNkLJ 7iW7NDFFQRYUFFcRhsFgsPXazvuh8eMaM5spn+h8IVcK4xMc4VFhICeUUn9bEUyx8Q UF3ZV8FHrdNlFbpr5B0TLpFFmndhJWEEdd16c6+8= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/110731] New: [11/12/13/14 Regression] Wrong-code because of wide-int division since r5-424 Date: Wed, 19 Jul 2023 07:18:50 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.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=3D110731 Bug ID: 110731 Summary: [11/12/13/14 Regression] Wrong-code because of wide-int division since r5-424 Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: jakub at gcc dot gnu.org Target Milestone: --- Since r5-424-g807e902eea17f313 (merge of wide-int) we miscompile following testcase (noticed it first with _BitInt(119)): __int128 foo (void) { struct S { __int128 f : 119; } s =3D { ((__int128) -18014398509481984) <<= 64 }; return s.f / 2; } int main () { if (foo () !=3D (((__int128) -9007199254740992) << 64)) __builtin_abort (); } The result of dividing (-332306998946228968225951765070086143wb - 1) by 2 is -166153499473114484112975882535043072wb but we return 166153499473114484112975882535043072wb instead (in hex that is 0, 0xffc0000000000000 signed 119 pair divided by 2 resulting in 0, 0x0020000000000000 signed 119 pair rather than 0, 0xffe0000000000000.=