Bug 37791 - switch does not handle signed values specified with 0x
Summary: switch does not handle signed values specified with 0x
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: gcc   
(Show other bugs)
Version: 7.0
Hardware: i386 Linux
medium
low
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: David Lawrence
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2001-04-26 11:53 UTC by Need Real Name
Modified: 2007-04-18 16:32 UTC (History)
0 users

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


Attachments (Terms of Use)

Description Need Real Name 2001-04-26 11:53:14 UTC
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
2.
3.
	

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 14:39:30 UTC
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.