public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/46460] New: shifting producing incorrect result
@ 2010-11-13  5:32 keefeg at gmail dot com
  2010-11-13  6:53 ` [Bug c/46460] " pinskia at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: keefeg at gmail dot com @ 2010-11-13  5:32 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-04-29 13:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-13  5:32 [Bug c/46460] New: shifting producing incorrect result keefeg at gmail dot com
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

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