Bug 37791 - switch does not handle signed values specified with 0x
switch does not handle signed values specified with 0x
Product: Red Hat Linux
Classification: Retired
Component: gcc (Show other bugs)
i386 Linux
medium Severity low
: ---
: ---
Assigned To: Jakub Jelinek
David Lawrence
Depends On:
  Show dependency treegraph
Reported: 2001-04-26 07:53 EDT by Need Real Name
Modified: 2007-04-18 12:32 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2002-12-15 09:39:30 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Need Real Name 2001-04-26 07:53:14 EDT
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)

The following code chunk demonstrates the problem. This generates a 
compile error. I have noticed that if I insert VALUE_A=-1, it compiles OK.

const int VALUE_A = 0xA04F1000;
const int VALUE_B = 0x00000099;

static void Fred(const int nType)
 switch ( nType )
  case VALUE_A : break;
  case VALUE_B : break;

Reproducible: Always
Steps to Reproduce:
1. COmpile the code in the above description

Actual Results:  test.cpp: In function `int main (int, char **)':
test.cpp:9: warning: overflow in implicit constant conversion
test.cpp:9: warning: case value out of range

Expected Results:  should compile OK
Comment 1 Alan Cox 2002-12-15 09:39:30 EST
This is not a bug. Check the C standards document.

Note You need to log in before you can comment on or make changes to this bug.