From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D7BDC3858C20; Fri, 5 May 2023 18:00:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D7BDC3858C20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1683309629; bh=nnZrFyqxgKrU27rVeR2fJUcBuDb1MzcyfET0xce81BU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Cks9EohPmjvXgQB/x8blmLonmg1Ul9F4MbklQCAwUlWG1Ib9DdfJdDE6e72VDypcB CcwIqdEiViFn5Hnd0t8dfKDwDC84YV69M1o924GMNrYvT8O6pSRzGlgDYDgl9M/VYm OmkgRGqfMbW9JE5uOJJ09qAu4VydKQwxAPLi5WkQ= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/109750] Incorrect code generated for shifted bit field Date: Fri, 05 May 2023 18:00:29 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 9.4.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: INVALID 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: 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=3D109750 --- Comment #4 from Andrew Pinski --- (In reply to jim.gray from comment #3) > The "correct" answer is also provided by the Intel C++ compiler, > so apparently GCC is the odd one out. I think MSVC is the odd one out really. see below. You can also do the testing yourself at https://godbolt.org/ to see that. Huh? Maybe ICC on windows gives a different answer than ICC on Linux. Which might make sense if ICC on Windows is trying to provide bug for bug compatibility with MSVC. ICC gives: icc: remark #10441: The Intel(R) C++ Compiler Classic (ICC) is deprecated a= nd will be removed from product release in the second half of 2023. The Intel(= R) oneAPI DPC++/C++ Compiler (ICX) is the recommended compiler moving forward. Please transition to use this compiler. Use '-diag-disable=3D10441' to disa= ble this message. ASM generation compiler returned: 0 icc: remark #10441: The Intel(R) C++ Compiler Classic (ICC) is deprecated a= nd will be removed from product release in the second half of 2023. The Intel(= R) oneAPI DPC++/C++ Compiler (ICX) is the recommended compiler moving forward. Please transition to use this compiler. Use '-diag-disable=3D10441' to disa= ble this message. Execution build compiler returned: 0 Program returned: 0 Example showing GCC bug: Source =3D 000000020000 Target =3D 000000000200 Target =3D 1777777777760000000200 clang gives: :103:14: warning: unused parameter 'argc' [-Wunused-parameter] int main(int argc, char *argv[]) { ^ :103:26: warning: unused parameter 'argv' [-Wunused-parameter] int main(int argc, char *argv[]) { ^ 2 warnings generated. ASM generation compiler returned: 0 :103:14: warning: unused parameter 'argc' [-Wunused-parameter] int main(int argc, char *argv[]) { ^ :103:26: warning: unused parameter 'argv' [-Wunused-parameter] int main(int argc, char *argv[]) { ^ 2 warnings generated. Execution build compiler returned: 0 Program returned: 0 Example showing GCC bug: Source =3D 000000020000 Target =3D 000000000200 Target =3D 1777777777760000000200=