public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "keefeg at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/46460] New: shifting producing incorrect result
Date: Sat, 13 Nov 2010 05:32:00 -0000	[thread overview]
Message-ID: <bug-46460-4@http.gcc.gnu.org/bugzilla/> (raw)

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46460

           Summary: shifting producing incorrect result
           Product: gcc
           Version: 4.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: keefeg@gmail.com


% cat bug.c
#include <stdio.h>

int main(void) {
  unsigned int ShouldBeZero;
  int cnt = 32;

  ShouldBeZero = 0xFFFFFFFF >> cnt;

  printf("Should print 0 here: %u\n", ShouldBeZero);

  return 0;
}

% cc -o bug bug.c
% ./bug
Should print 0 here: 4294967295

% cc -o bug -O3 bug.c
% ./bug
Should print 0 here: 0

% gcc -v
Using built-in specs.
Target: amd64-undermydesk-freebsd
Configured with: FreeBSD/amd64 system compiler
Thread model: posix
gcc version 4.2.1 20070719  [FreeBSD]

% sysctl -a | grep 'hw\.model'
hw.model: AMD Phenom(tm) II X4 955 Processor


             reply	other threads:[~2010-11-13  1:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-13  5:32 keefeg at gmail dot com [this message]
2010-11-13  6:53 ` [Bug c/46460] " pinskia at gcc dot gnu.org
2010-11-13 15:10 ` [Bug c/46460] warn for shifting more than the bits in the (promoted) type is undefined manu at gcc dot gnu.org
2010-11-17  9:45 ` schwab@linux-m68k.org
2014-04-29 13:06 ` mpolacek at gcc dot gnu.org

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=bug-46460-4@http.gcc.gnu.org/bugzilla/ \
    --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).