From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9459 invoked by alias); 4 Oct 2002 19:26:02 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 9437 invoked by uid 71); 4 Oct 2002 19:26:01 -0000 Resent-Date: 4 Oct 2002 19:26:01 -0000 Resent-Message-ID: <20021004192601.9436.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, acme@us.ibm.com Received: (qmail 4493 invoked by uid 61); 4 Oct 2002 19:16:26 -0000 Message-Id: <20021004191626.4492.qmail@sources.redhat.com> Date: Fri, 04 Oct 2002 12:26:00 -0000 From: acme@us.ibm.com Reply-To: acme@us.ibm.com To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: c/8148: simple bit shifting does not work X-SW-Source: 2002-10/txt/msg00166.txt.bz2 List-Id: >Number: 8148 >Category: c >Synopsis: simple bit shifting does not work >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Fri Oct 04 12:26:00 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Bryan Hunt >Release: 3.2 >Organization: >Environment: System: Linux tritium.austin.ibm.com 2.4.9-34 #1 Sat Jun 1 06:25:16 EDT 2002 i686 unknown Architecture: i686 host: i686-pc-linux-gnu build: i686-pc-linux-gnu target: i686-pc-linux-gnu configured with: /home/bhunt/gcc-3.2/configure --enable-languages=c,c++ >Description: shifting a variable a number of bits greater or equal to its size produces incorrect results. This problem has been verified with both unsigned and unsigned long long. This problem has only been seen on x86 Linux. Both gcc 3.0.3 and xlC 5.0 on AIX 4.3 produces correct results. >How-To-Repeat: #include using namespace std; int main(int argc, char* argv[]) { unsigned x = 0xffffffff; x = x << 32; if(x != 0) cout << "Bit shifting is broken: expected 0x0, but got: " << hex << x << endl; else cout << "Bit shifting works" << endl; return 0; } >Fix: >Release-Note: >Audit-Trail: >Unformatted: