From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8DD343858D37; Sun, 22 Oct 2023 02:09:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8DD343858D37 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1697940549; bh=xdyoO5/RQWHNfWVLCubpFlnDVTbapMsf9LkNyC/UxEo=; h=From:To:Subject:Date:From; b=AftWLeVgatPG9WCH1wvsEz4RylSer7Shh9yWgc3ApJIm0YS6cX9BRb/RROpXILeDZ F2smVsOk95BfVsFm6sRIoHnMLRJvHRSaLv8iiTHimRzkgyhutR3XzdNAs9StbHkDRQ pW7KUIcbrKsJ+pJN33CsEQvGg96PZ7lAaznpfgNA= From: "141242068 at smail dot nju.edu.cn" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/111913] New: GCC: 14: -O1 compile __builtin_popcount fails while -O0 succeeds Date: Sun, 22 Oct 2023 02:09: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: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: 141242068 at smail dot nju.edu.cn 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=3D111913 Bug ID: 111913 Summary: GCC: 14: -O1 compile __builtin_popcount fails while -O0 succeeds Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: 141242068 at smail dot nju.edu.cn Target Milestone: --- When compile this program with `-O1`, gcc crashes: ``` int f(unsigned int x, unsigned int y) { return __builtin_popcount (x&y) + __builtin_popcount (y|x--); } ``` If change the optimization level to `-O0`, then nothing happens. Compiler Explorer: https://gcc.godbolt.org/z/naoebKMor The stack dump: ``` : In function 'f': :4:1: error: invalid conversion in gimple call 4 | } | ^ unsigned int int _3 =3D __builtin_popcount (x_6(D)); :4:1: error: invalid conversion in gimple call unsigned int int _11 =3D __builtin_popcount (y_7(D)); :4:1: error: type mismatch in binary expression int unsigned int unsigned int _9 =3D _3 + _11; during GIMPLE pass: forwprop :4:1: internal compiler error: verify_gimple failed 0x231f49e internal_error(char const*, ...) ???:0 0x1164659 verify_gimple_in_cfg(function*, bool, bool) ???:0 Please submit a full bug report, with preprocessed source (by using -freport-bug). Please include the complete backtrace with any bug report. See for instructions. ```=