public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Ben Kohlen <bckohlen@yahoo.com>
To: gcc-help@gcc.gnu.org
Subject: bug?
Date: Fri, 15 Jun 2001 15:57:00 -0000	[thread overview]
Message-ID: <20010615225730.76865.qmail@web11001.mail.yahoo.com> (raw)

I am expecting that when I shift right, I will always
get zeroes in from the left, but when I use data types
less than 32 bits, this is not always the case.

Example:
...
unsigned short s = 0xcc55;
printf("%x\n", (s<<8)>>8);
...
yeilds the output "cc55" where as I was expecting
"55".

I was expecting this to be equivalent to:
...
s = s << 8;
s = s >> 8;
...
in which you do explicit assignment, which does yeild
"55" as the output.

Is this part of C spec, unspecified by C, or actually
a gcc bug?

gcc version 2.95.3 20010315 (release) on an x86 btw.

Please CC responses, as I am not on the list.

Cheers,
Ben

__________________________________________________
Do You Yahoo!?
Spot the hottest trends in music, movies, and more.
http://buzz.yahoo.com/

             reply	other threads:[~2001-06-15 15:57 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-06-15 15:57 Ben Kohlen [this message]
2001-06-15 16:38 ` bug? David Berthelot
2001-06-15 18:59 ` bug? Alexandre Oliva
2001-06-17  2:55 ` bug? Ingo Krabbe
2001-06-18 10:06   ` bug? David Berthelot
2001-06-18 11:46     ` bug? Ingo Krabbe
2001-06-18 23:05       ` bug? Alexandre Oliva
2001-06-18 23:58         ` bug? Ingo Krabbe
2001-06-19  0:31           ` bug? Alexandre Oliva
2001-06-19  5:55             ` bug? Ingo Krabbe
2001-06-20  7:57               ` bug? Alexandre Oliva
2002-02-06  4:34 Bug???? kabir.patel
2003-09-20  7:45 Bug? Brian
2005-08-25 23:33 bug? Alexey Sokolov
2005-08-26  1:06 ` bug? corey taylor
2005-08-26 12:07 ` bug? Eljay Love-Jensen
2007-10-21 14:27 bug? skaller
2007-10-22 11:19 ` bug? John Love-Jensen
2007-10-23  8:04   ` bug? skaller

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=20010615225730.76865.qmail@web11001.mail.yahoo.com \
    --to=bckohlen@yahoo.com \
    --cc=gcc-help@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).