From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18518 invoked by alias); 1 Dec 2005 10:53:08 -0000 Received: (qmail 18504 invoked by uid 48); 1 Dec 2005 10:53:06 -0000 Date: Thu, 01 Dec 2005 10:53:00 -0000 Message-ID: <20051201105306.18503.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug middle-end/25186] (short)(((int)short_var) <<1) should be folded so that the shift is done in the short type In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "rguenth at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2005-12/txt/msg00041.txt.bz2 List-Id: ------- Comment #2 from rguenth at gcc dot gnu dot org 2005-12-01 10:53 ------- Confirmed. The first testcase is really just short *a; void f(void) { *a = *a << 1; } interestingly, the C frontend does not do integer promotion of unsigned short *a; void f(voif) { *a = *a << 1; } where *a should be promoted to int as of 6.3.1.8 and 6.5.7/3, which says "Integer promotions are performed on each of the operands". Now the question is how to read this, but either the C frontend does unnecessary promution for the signed case or it misses it for the unsigned case. -- rguenth at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Last reconfirmed|0000-00-00 00:00:00 |2005-12-01 10:53:06 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25186