[Bug c/46460] New: shifting producing incorrect result
keefeg at gmail dot com
gcc-bugzilla@gcc.gnu.org
Sat Nov 13 05:32:00 GMT 2010
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
More information about the Gcc-bugs
mailing list