From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id BA59E3858D20; Sat, 28 Jan 2023 12:21:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BA59E3858D20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1674908475; bh=nQDfaaUfwd1NBemMlj3yJ/cJrkA/2lCRYpy9gbPR1FA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=GCbsFyctEr5jYK3/uFc68vJCphb34mPNhCXogtq8f0P//zJh9EcYuI+982a+pDl9k CCOO/49QjFpPe7XH05Kish1leFSpvh1MQHrpRYiqXv0FS26RkRctIJyVXHmgP2DCkD 6NuJ4/Y0adzD/l/6KBC4g2IujKn7Zo6Rl23B3cSo= From: "postmaster at raasu dot org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/108580] gcc treats shifts as signed operation, does wrong promotion Date: Sat, 28 Jan 2023 12:21:15 +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: 12.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: postmaster at raasu dot 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=3D108580 --- Comment #6 from postmaster at raasu dot org --- There is wrong assumption again... Literal "1" is always unsigned as there = is no implicit signed literals, even though there is explicit signed literals.= .. When somebody writes "-1" it is treated as expression "0 - 1", not a literal "negative one"... This is because subtract operator has higher precedence. Empty literal always equals to literal "0".=