From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7658A385B527; Mon, 28 Nov 2022 16:57:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7658A385B527 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1669654666; bh=jN5LSGnLfF+eXOuDifSK5qXgI1EAo6c+lHeGoqIMrGI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=AJTGA+pTKtoUCQz5EVv+MAYZDMtXv9rS4WIDefUQX7tyWVDOFRFgXZC4WsM6QNaqq 9DJ/EZwEZxU32NtyN0XcaMtcIGtUt5hFe8JpmaS1SjWyc4kwnCr0EG+mv2VoIc3fVi zASSvlvxRTQa/G/4+Qc9ibTLfC374k3gRUeDkWms= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/107885] H8/300: libsupc++/hash_bytes.cc fix shift-count-overflow warning Date: Mon, 28 Nov 2022 16:57:45 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 12.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: redi 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=3D107885 --- Comment #1 from CVS Commits --- The master branch has been updated by Jonathan Wakely : https://gcc.gnu.org/g:7b79fa930917da735f02b4f6911dfbb0a91f9714 commit r13-4369-g7b79fa930917da735f02b4f6911dfbb0a91f9714 Author: Jonathan Wakely Date: Mon Nov 28 10:52:23 2022 +0000 libstdc++: Fix _Hash_bytes for I16LP32 targets [PR107885] For H8/300 size_t is 32 bits wide, but (unsigned char)buf[2] << 16 promotes to int which is only 16 bits wide. The shift is then undefined. This fixes it by converting to size_t before shifting. libstdc++-v3/ChangeLog: PR libstdc++/107885 * libsupc++/hash_bytes.cc (_Hash_bytes): Convert to size_t instead of implicit integer promotion to 16 bits.=