This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/25186] (short)(((int)short_var) <<1) should be folded so that the shift is done in the short type
- From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 1 Dec 2005 10:53:06 -0000
- Subject: [Bug middle-end/25186] (short)(((int)short_var) <<1) should be folded so that the shift is done in the short type
- References: <bug-25186-6528@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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