From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E0AF53858C83; Sat, 22 Apr 2023 08:06:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E0AF53858C83 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1682150811; bh=kFXes6X8kb0m0GyTH/CwtVXghDqopHxrrvIKGjyF7a0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=C9+ey2NEFZc7759OZNJS/GyqKzifxyt9iKrVKbUcoMZ6dPR2kHWFd8ZImPQe13pdx RBszPEtL0QeAueOaINSYZZ3De6avvjZMsZg+JmQwmuw8NtDo3KSTmXD/XO/zf1o/CR RVTCPXY/PkeSbvO+/dS78XN/5BkrAKqjQpb6EjV4= From: "roger at nextmovesoftware dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/25186] (short)(((int)short_var) <<1) should be folded so that the shift is done in the short type Date: Sat, 22 Apr 2023 08:06:50 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 4.2.0 X-Bugzilla-Keywords: easyhack, missed-optimization, TREE X-Bugzilla-Severity: enhancement X-Bugzilla-Who: roger at nextmovesoftware dot com X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: FIXED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: target_milestone bug_status resolution cc cf_known_to_work 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=3D25186 Roger Sayle changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |13.0 Status|NEW |RESOLVED Resolution|--- |FIXED CC| |roger at nextmovesoftware = dot com Known to work| |13.0 --- Comment #10 from Roger Sayle --- This is now fixed (at the tree level) on mainline (and was fixed in GCC 13). For those wondering, LSHIFT_EXPR is well defined (in this case) in GIMPLE, hence the "optimized" dump currently looks like: void f () { short int * a.0_1; short int _2; short int _3; a.0_1 =3D a; _2 =3D *a.0_1; _3 =3D _2 << 1; *a.0_1 =3D _3; return; }=