public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: wheisler@inflow.com
To: gcc-gnats@gcc.gnu.org
Subject: c/6607: Inconsisitency using right shift operator (signed vs. unsigned shift)
Date: Wed, 08 May 2002 10:16:00 -0000	[thread overview]
Message-ID: <20020508171303.18061.qmail@sources.redhat.com> (raw)


>Number:         6607
>Category:       c
>Synopsis:       Inconsisitency using right shift operator (signed vs. unsigned shift)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed May 08 10:16:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Bill Heisler
>Release:        gcc 2.96 20000731
>Organization:
>Environment:
RH 7.1 Intel Glibc 2.2.3-16 gcc 2.96
>Description:
When using a right shift operator that can be calculated at compile time, the operator performs an unsigned shift (prepends zeros).  If the shift is parameterized, and is calculated at run time, a signed shift is performed (prepends high order bit).
>How-To-Repeat:
#include <stdio.h>

int main (int argc, char ** argv) {
   unsigned int i = 0xffffffff >> 32;
   unsigned int j = 0xffffffff;

   j = j >> 32;

   printf("i -- %x\nj -- %x\n", i, j);
}
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


             reply	other threads:[~2002-05-08 17:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-08 10:16 wheisler [this message]
2002-05-08 10:38 neil
2002-05-09 23:04 neil

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=20020508171303.18061.qmail@sources.redhat.com \
    --to=wheisler@inflow.com \
    --cc=gcc-gnats@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).