From mboxrd@z Thu Jan 1 00:00:00 1970 From: gustav@virtutech.se To: gcc-gnats@gcc.gnu.org Cc: mattias@virtutech.se Subject: c/4210: bad warning with dead code Date: Mon, 03 Sep 2001 11:36:00 -0000 Message-id: <20010903182858.26588.qmail@sourceware.cygnus.com> X-SW-Source: 2001-09/msg00040.html List-Id: >Number: 4210 >Category: c >Synopsis: bad warning with dead code >Confidential: no >Severity: non-critical >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Mon Sep 03 11:36:00 PDT 2001 >Closed-Date: >Last-Modified: >Originator: gustav@virtutech.se >Release: GNU C version 3.0.1 20010626 (prerelease) (i386-pc-linux-gnu) >Organization: >Environment: >Description: gcc outputs a warning about shifts >= width of type inside dead code when that code is dead because of a const variable. This can easily happen in autogenerated code, or when you do operations on preprocessor defines. >How-To-Repeat: Compile the following with -Wall -O2: int rol0(int a) { const int b = 0; if (b) { a = (a << b) | (a >> (8 * sizeof a - b)); } return a; } >Fix: >Release-Note: >Audit-Trail: >Unformatted: