public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
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: Thu, 01 Dec 2005 10:53:00 -0000	[thread overview]
Message-ID: <20051201105306.18503.qmail@sourceware.org> (raw)
In-Reply-To: <bug-25186-6528@http.gcc.gnu.org/bugzilla/>



------- 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


  parent reply	other threads:[~2005-12-01 10:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-30 18:21 [Bug middle-end/25186] New: (short)(((int)short_var) <<1) should be done in short pinskia at gcc dot gnu dot org
2005-11-30 18:32 ` [Bug middle-end/25186] " pinskia at gcc dot gnu dot org
2005-12-01 10:53 ` rguenth at gcc dot gnu dot org [this message]
2005-12-01 11:01 ` [Bug middle-end/25186] (short)(((int)short_var) <<1) should be folded so that the shift is done in the short type rguenth at gcc dot gnu dot org
2005-12-01 12:28 ` rguenth at gcc dot gnu dot org
2005-12-01 12:46 ` rguenth at gcc dot gnu dot org
2005-12-01 14:17 ` rguenth at gcc dot gnu dot org
2006-04-05 13:49 ` rguenth at gcc dot gnu dot org
     [not found] <bug-25186-4@http.gcc.gnu.org/bugzilla/>
2021-09-02  2:03 ` gabravier at gmail dot com
2021-09-02  7:15 ` rguenth at gcc dot gnu.org
2023-04-22  8:06 ` roger at nextmovesoftware dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20051201105306.18503.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).